Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8442

Show
Ignore:
Timestamp:
12/19/07 21:16:27 (8 months ago)
Author:
bitsweat
Message:

Revert [8392]. Closes #10568, reopens #10379.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activerecord/lib/active_record/fixtures.rb

    r8392 r8442  
    917917 
    918918      def setup_with_fixtures 
    919         return if @fixtures_setup 
    920         @fixtures_setup = true 
    921919        return unless defined?(ActiveRecord::Base) && !ActiveRecord::Base.configurations.blank? 
    922920 
     
    950948 
    951949      def teardown_with_fixtures 
    952         return if @fixtures_teardown 
    953         @fixtures_teardown = true 
    954950        return unless defined?(ActiveRecord::Base) && !ActiveRecord::Base.configurations.blank? 
    955951 
     
    968964 
    969965      def self.method_added(method) 
    970         return if @__disable_method_added__ 
    971         @__disable_method_added__ = true 
    972          
    973966        case method.to_s 
    974967        when 'setup' 
    975968          unless method_defined?(:setup_without_fixtures) 
    976969            alias_method :setup_without_fixtures, :setup 
    977             define_method(:full_setup) do 
     970            define_method(:setup) do 
    978971              setup_with_fixtures 
    979972              setup_without_fixtures 
    980973            end 
    981974          end 
    982           alias_method :setup, :full_setup 
    983975        when 'teardown' 
    984976          unless method_defined?(:teardown_without_fixtures) 
    985977            alias_method :teardown_without_fixtures, :teardown 
    986             define_method(:full_teardown) do 
     978            define_method(:teardown) do 
    987979              teardown_without_fixtures 
    988980              teardown_with_fixtures 
    989981            end 
    990982          end 
    991           alias_method :teardown, :full_teardown 
    992         end 
    993          
    994         @__disable_method_added__ = false 
     983        end 
    995984      end 
    996985 
  • trunk/activerecord/test/fixtures_test.rb

    r8392 r8442  
    325325end 
    326326 
    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  
    343327class OverlappingFixturesTest < Test::Unit::TestCase 
    344328  fixtures :topics, :developers