Permalink
Browse files

Make fixtures work with the new test subclasses. [tarmo, Koz]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8060 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent e86d1de commit 3c9cd19786b1e74114d933594225f2fa37407be2 @NZKoz NZKoz committed Oct 31, 2007
@@ -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)
@@ -769,12 +769,12 @@ def read_fixture_file(fixture_file_path)
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
@@ -4,6 +4,7 @@
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.
@@ -417,7 +417,7 @@ def load_fixtures
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 @@ def test_supports_label_interpolation
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

0 comments on commit 3c9cd19

Please sign in to comment.