diff options
-rwxr-xr-x | activerecord/lib/active_record/fixtures.rb | 2 | ||||
-rw-r--r-- | railties/helpers/test_helper.rb | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index 92c4647819..2fe89aac16 100755 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -490,10 +490,12 @@ module Test #:nodoc: def self.setup_fixture_accessors(table_names=nil) (table_names || fixture_table_names).each do |table_name| table_name = table_name.to_s.tr('.','_') + define_method(table_name) do |fixture, *optionals| force_reload = optionals.shift @fixture_cache[table_name] ||= Hash.new @fixture_cache[table_name][fixture] = nil if force_reload + if @loaded_fixtures[table_name][fixture.to_s] @fixture_cache[table_name][fixture] ||= @loaded_fixtures[table_name][fixture.to_s].find else diff --git a/railties/helpers/test_helper.rb b/railties/helpers/test_helper.rb index d13753a655..6970dbac37 100644 --- a/railties/helpers/test_helper.rb +++ b/railties/helpers/test_helper.rb @@ -27,6 +27,9 @@ class Test::Unit::TestCase # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. # If you need to control the loading order (due to foreign key constraints etc), you'll # need to change this line to explicitly name the order you desire. + # + # Note: You'll currently still have to declare fixtures explicitly in integration tests + # -- they do not yet inherent this setting fixtures :all # Add more helper methods to be used by all tests here... |