1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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
This commit is contained in:
Michael Koziarski 2007-10-31 05:43:52 +00:00
parent e86d1decc1
commit 3c9cd19786
4 changed files with 20 additions and 7 deletions

View file

@ -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)

View file

@ -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

View file

@ -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.

View file

@ -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