@@ -96,6 +96,14 @@ def uses_transaction?(method)
96
96
end
97
97
end
98
98
99
+ # Generic fixture accessor for fixture names that may conflict with other methods.
100
+ #
101
+ # assert_equal "Ruby on Rails", web_sites(:rubyonrails).name
102
+ # assert_equal "Ruby on Rails", fixture(:web_sites, :rubyonrails).name
103
+ def fixture ( fixture_set_name , *fixture_names )
104
+ active_record_fixture ( fixture_set_name , *fixture_names )
105
+ end
106
+
99
107
private
100
108
def run_in_transaction?
101
109
use_transactional_tests &&
@@ -255,7 +263,7 @@ def load_instances?
255
263
256
264
def method_missing ( method , ...)
257
265
if fixture_sets . key? ( method . name )
258
- _active_record_fixture ( method , ...)
266
+ active_record_fixture ( method , ...)
259
267
else
260
268
super
261
269
end
@@ -269,14 +277,13 @@ def respond_to_missing?(method, include_private = false)
269
277
end
270
278
end
271
279
272
- def _active_record_fixture ( fixture_set_name , *fixture_names )
280
+ def active_record_fixture ( fixture_set_name , *fixture_names )
273
281
if fs_name = fixture_sets [ fixture_set_name . name ]
274
282
access_fixture ( fs_name , *fixture_names )
275
283
else
276
284
raise StandardError , "No fixture set named '#{ fixture_set_name . inspect } '"
277
285
end
278
286
end
279
- alias_method :fixture , :_active_record_fixture
280
287
281
288
def access_fixture ( fs_name , *fixture_names )
282
289
force_reload = fixture_names . pop if fixture_names . last == true || fixture_names . last == :reload
0 commit comments