Skip to content

Commit

Permalink
Revert "scrub instance variables from test cases on teardown"
Browse files Browse the repository at this point in the history
This reverts commit 1e98920.
  • Loading branch information
jamis committed Jan 19, 2011
1 parent 039b807 commit e5664b5
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 41 deletions.
2 changes: 0 additions & 2 deletions activesupport/lib/active_support/test_case.rb
Expand Up @@ -6,7 +6,6 @@
require 'active_support/testing/pending'
require 'active_support/testing/isolation'
require 'active_support/core_ext/kernel/reporting'
require 'active_support/testing/garbage_collection'

begin
silence_warnings { require 'mocha' }
Expand Down Expand Up @@ -39,6 +38,5 @@ def self.for_tag(tag)
include ActiveSupport::Testing::Deprecation
include ActiveSupport::Testing::Pending
extend ActiveSupport::Testing::Declarative
include ActiveSupport::Testing::GarbageCollection
end
end
19 changes: 0 additions & 19 deletions activesupport/lib/active_support/testing/garbage_collection.rb

This file was deleted.

18 changes: 0 additions & 18 deletions activesupport/test/test_case_test.rb
Expand Up @@ -74,23 +74,5 @@ def test_true; assert true end

assert_match %r{oh noes}, exception.message
end

def test_teardown_should_scrub_instance_variables
tc = Class.new(TestCase) do
def test_true; @alpha = "a"; assert_equal "a", @alpha; end
end

test_name = 'test_true'
fr = FakeRunner.new

test = tc.new test_name
test.run(fr) {}

passed_var = IS_MINITEST ? :@passed : :@test_passed
ivars = test.instance_variables.map(&:to_sym)

assert ivars.include?(passed_var), "#{passed_var} should not have been scrubbed"
assert !ivars.include?(:@alpha), "@alpha should have been scrubbed"
end
end
end
4 changes: 2 additions & 2 deletions activesupport/test/test_test.rb
Expand Up @@ -144,7 +144,7 @@ class SetupAndTeardownTest < ActiveSupport::TestCase
def test_inherited_setup_callbacks
assert_equal [:reset_callback_record, :foo], self.class._setup_callbacks.map(&:raw_filter)
assert_equal [:foo], @called_back
assert_equal [:scrub_leftover_instance_variables, :foo, :sentinel, :foo], self.class._teardown_callbacks.map(&:raw_filter)
assert_equal [:foo, :sentinel, :foo], self.class._teardown_callbacks.map(&:raw_filter)
end

def setup
Expand Down Expand Up @@ -176,7 +176,7 @@ class SubclassSetupAndTeardownTest < SetupAndTeardownTest
def test_inherited_setup_callbacks
assert_equal [:reset_callback_record, :foo, :bar], self.class._setup_callbacks.map(&:raw_filter)
assert_equal [:foo, :bar], @called_back
assert_equal [:scrub_leftover_instance_variables, :foo, :sentinel, :foo, :bar], self.class._teardown_callbacks.map(&:raw_filter)
assert_equal [:foo, :sentinel, :foo, :bar], self.class._teardown_callbacks.map(&:raw_filter)
end

protected
Expand Down

0 comments on commit e5664b5

Please sign in to comment.