diff options
-rwxr-xr-x | activerecord/lib/active_record/fixtures.rb | 11 | ||||
-rwxr-xr-x | activerecord/test/abstract_unit.rb | 1 | ||||
-rwxr-xr-x | activerecord/test/validations_test.rb | 4 |
3 files changed, 12 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index 320b0dbe78..8447a33c7d 100755 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -301,9 +301,20 @@ class Test::Unit::TestCase #:nodoc: cattr_accessor :fixture_table_names def self.fixtures(*table_names) + require_fixture_classes(table_names) write_inheritable_attribute("fixture_table_names", table_names) end + def self.require_fixture_classes(table_names) + table_names.each do |table_name| + begin + require(Inflector.singularize(table_name.to_s)) + rescue LoadError + # Let's hope the developer is included it himself + end + end + end + def setup instantiate_fixtures(*fixture_table_names) if fixture_table_names end diff --git a/activerecord/test/abstract_unit.rb b/activerecord/test/abstract_unit.rb index a4a1b55cb2..293f3ba6b3 100755 --- a/activerecord/test/abstract_unit.rb +++ b/activerecord/test/abstract_unit.rb @@ -1,4 +1,5 @@ $:.unshift(File.dirname(__FILE__) + '/../lib') +# $:.unshift(File.dirname(__FILE__) + '/fixtures') require 'test/unit' require 'active_record' diff --git a/activerecord/test/validations_test.rb b/activerecord/test/validations_test.rb index b4b0997c94..e104573c25 100755 --- a/activerecord/test/validations_test.rb +++ b/activerecord/test/validations_test.rb @@ -1,8 +1,4 @@ require 'abstract_unit' -require 'fixtures/topic' -require 'fixtures/reply' -require 'fixtures/developer' - class ValidationsTest < Test::Unit::TestCase fixtures :topics, :developers |