Changeset 8442
- Timestamp:
- 12/19/07 21:16:27 (2 years ago)
- Files:
-
- 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/lib/active_record/fixtures.rb
r8392 r8442 917 917 918 918 def setup_with_fixtures 919 return if @fixtures_setup920 @fixtures_setup = true921 919 return unless defined?(ActiveRecord::Base) && !ActiveRecord::Base.configurations.blank? 922 920 … … 950 948 951 949 def teardown_with_fixtures 952 return if @fixtures_teardown953 @fixtures_teardown = true954 950 return unless defined?(ActiveRecord::Base) && !ActiveRecord::Base.configurations.blank? 955 951 … … 968 964 969 965 def self.method_added(method) 970 return if @__disable_method_added__971 @__disable_method_added__ = true972 973 966 case method.to_s 974 967 when 'setup' 975 968 unless method_defined?(:setup_without_fixtures) 976 969 alias_method :setup_without_fixtures, :setup 977 define_method(: full_setup) do970 define_method(:setup) do 978 971 setup_with_fixtures 979 972 setup_without_fixtures 980 973 end 981 974 end 982 alias_method :setup, :full_setup983 975 when 'teardown' 984 976 unless method_defined?(:teardown_without_fixtures) 985 977 alias_method :teardown_without_fixtures, :teardown 986 define_method(: full_teardown) do978 define_method(:teardown) do 987 979 teardown_without_fixtures 988 980 teardown_with_fixtures 989 981 end 990 982 end 991 alias_method :teardown, :full_teardown 992 end 993 994 @__disable_method_added__ = false 983 end 995 984 end 996 985 trunk/activerecord/test/fixtures_test.rb
r8392 r8442 325 325 end 326 326 327 # This is to reproduce a bug where if a TestCase is loaded328 # twice by Ruby, it loses its fixture setup hook.329 class_def = <<-CODE330 class DoubleLoadedTestCase < Test::Unit::TestCase331 fixtures :topics332 333 def setup334 end335 336 def test_should_properly_setup_fixtures337 assert_nothing_raised { topics(:first) }338 end339 end340 CODE341 2.times { eval(class_def) }342 343 327 class OverlappingFixturesTest < Test::Unit::TestCase 344 328 fixtures :topics, :developers