aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activerecord/CHANGELOG2
-rwxr-xr-xactiverecord/lib/active_record/fixtures.rb12
-rwxr-xr-xactiverecord/test/abstract_unit.rb1
-rwxr-xr-xactiverecord/test/fixtures_test.rb12
4 files changed, 20 insertions, 7 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index ecea80cc5c..9624ef38ad 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Make fixtures work with the new test subclasses. [tarmo, Koz]
+
* Introduce finder :joins with associations. Same :include syntax but with inner rather than outer joins. #10012 [RubyRedRick]
# Find users with an avatar
User.find(:all, :joins => :avatar)
diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb
index c9fc87756d..41e389d4fe 100755
--- a/activerecord/lib/active_record/fixtures.rb
+++ b/activerecord/lib/active_record/fixtures.rb
@@ -769,12 +769,12 @@ end
module Test #:nodoc:
module Unit #:nodoc:
class TestCase #:nodoc:
- class_inheritable_accessor :fixture_path
- class_inheritable_accessor :fixture_table_names
- class_inheritable_accessor :fixture_class_names
- class_inheritable_accessor :use_transactional_fixtures
- class_inheritable_accessor :use_instantiated_fixtures # true, false, or :no_instances
- class_inheritable_accessor :pre_loaded_fixtures
+ superclass_delegating_accessor :fixture_path
+ superclass_delegating_accessor :fixture_table_names
+ superclass_delegating_accessor :fixture_class_names
+ superclass_delegating_accessor :use_transactional_fixtures
+ superclass_delegating_accessor :use_instantiated_fixtures # true, false, or :no_instances
+ superclass_delegating_accessor :pre_loaded_fixtures
self.fixture_table_names = []
self.use_transactional_fixtures = false
diff --git a/activerecord/test/abstract_unit.rb b/activerecord/test/abstract_unit.rb
index 9d8adf2509..a09c8daad5 100755
--- a/activerecord/test/abstract_unit.rb
+++ b/activerecord/test/abstract_unit.rb
@@ -4,6 +4,7 @@ $:.unshift(File.dirname(__FILE__) + '/../../activesupport/lib')
require 'test/unit'
require 'active_record'
require 'active_record/fixtures'
+require 'active_support/test_case'
require 'connection'
# Show backtraces for deprecated behavior for quicker cleanup.
diff --git a/activerecord/test/fixtures_test.rb b/activerecord/test/fixtures_test.rb
index 2bc72d0b4e..40790a607d 100755
--- a/activerecord/test/fixtures_test.rb
+++ b/activerecord/test/fixtures_test.rb
@@ -417,7 +417,7 @@ class FixturesBrokenRollbackTest < Test::Unit::TestCase
end
class LoadAllFixturesTest < Test::Unit::TestCase
- write_inheritable_attribute :fixture_path, File.join(File.dirname(__FILE__), '/fixtures/all')
+ self.fixture_path= File.join(File.dirname(__FILE__), '/fixtures/all')
fixtures :all
def test_all_there
@@ -529,3 +529,13 @@ class FoxyFixturesTest < Test::Unit::TestCase
assert_equal("frederick", parrots(:frederick).name)
end
end
+
+class ActiveSupportSubclassWithFixturesTest < ActiveSupport::TestCase
+ fixtures :parrots
+
+ # This seemingly useless assertion catches a bug that caused the fixtures
+ # setup code call nil[]
+ def test_foo
+ assert_equal parrots(:louis), Parrot.find_by_name("King Louis")
+ end
+end \ No newline at end of file