Changeset 8392
- Timestamp:
- 12/15/07 01:23:05 (7 months ago)
- Files:
-
- trunk/activerecord/CHANGELOG (modified) (1 diff)
- trunk/activerecord/lib/active_record/fixtures.rb (modified) (3 diffs)
- trunk/activerecord/test/fixtures_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activerecord/CHANGELOG
r8377 r8392 1 1 *SVN* 2 3 * Make the Fixtures Test::Unit enhancements more supporting for double-loaded test cases. Closes #10379 [brynary] 2 4 3 5 * Fix that validates_acceptance_of still works for non-existent tables (useful for bootstrapping new databases). Closes #10474 [hasmanyjosh] trunk/activerecord/lib/active_record/fixtures.rb
r8339 r8392 917 917 918 918 def setup_with_fixtures 919 return if @fixtures_setup 920 @fixtures_setup = true 919 921 return unless defined?(ActiveRecord::Base) && !ActiveRecord::Base.configurations.blank? 920 922 … … 948 950 949 951 def teardown_with_fixtures 952 return if @fixtures_teardown 953 @fixtures_teardown = true 950 954 return unless defined?(ActiveRecord::Base) && !ActiveRecord::Base.configurations.blank? 951 955 … … 964 968 965 969 def self.method_added(method) 970 return if @__disable_method_added__ 971 @__disable_method_added__ = true 972 966 973 case method.to_s 967 974 when 'setup' 968 975 unless method_defined?(:setup_without_fixtures) 969 976 alias_method :setup_without_fixtures, :setup 970 define_method(: setup) do977 define_method(:full_setup) do 971 978 setup_with_fixtures 972 979 setup_without_fixtures 973 980 end 974 981 end 982 alias_method :setup, :full_setup 975 983 when 'teardown' 976 984 unless method_defined?(:teardown_without_fixtures) 977 985 alias_method :teardown_without_fixtures, :teardown 978 define_method(: teardown) do986 define_method(:full_teardown) do 979 987 teardown_without_fixtures 980 988 teardown_with_fixtures 981 989 end 982 990 end 983 end 991 alias_method :teardown, :full_teardown 992 end 993 994 @__disable_method_added__ = false 984 995 end 985 996 trunk/activerecord/test/fixtures_test.rb
r8219 r8392 325 325 end 326 326 327 # This is to reproduce a bug where if a TestCase is loaded 328 # twice by Ruby, it loses its fixture setup hook. 329 class_def = <<-CODE 330 class DoubleLoadedTestCase < Test::Unit::TestCase 331 fixtures :topics 332 333 def setup 334 end 335 336 def test_should_properly_setup_fixtures 337 assert_nothing_raised { topics(:first) } 338 end 339 end 340 CODE 341 2.times { eval(class_def) } 342 327 343 class OverlappingFixturesTest < Test::Unit::TestCase 328 344 fixtures :topics, :developers