Skip to content

Commit

Permalink
Merge pull request #4354 from rafaelfranca/patch-1
Browse files Browse the repository at this point in the history
Remove some checks if MiniTest is defined
  • Loading branch information
tenderlove committed Jan 6, 2012
2 parents 0db9394 + b2fca95 commit aec8172
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 212 deletions.
18 changes: 0 additions & 18 deletions activesupport/test/deprecation_test.rb
Expand Up @@ -166,22 +166,4 @@ def test_deprecation_with_alternate_method
def test_deprecation_with_explicit_message
assert_deprecated(/you now need to do something extra for this one/) { @dtc.d }
end

unless defined?(::MiniTest)
def test_assertion_failed_error_doesnt_spout_deprecation_warnings
error_class = Class.new(StandardError) do
def message
ActiveSupport::Deprecation.warn 'warning in error message'
super
end
end

raise error_class.new('hmm')

rescue => e
error = Test::Unit::Error.new('testing ur doodz', e)
assert_not_deprecated { error.message }
assert_nil @last_message
end
end
end
162 changes: 0 additions & 162 deletions activesupport/test/isolation_test.rb

This file was deleted.

62 changes: 30 additions & 32 deletions activesupport/test/test_case_test.rb
Expand Up @@ -18,44 +18,42 @@ def options
end
end

if defined?(MiniTest::Assertions) && TestCase < MiniTest::Assertions
def test_callback_with_exception
tc = Class.new(TestCase) do
setup :bad_callback
def bad_callback; raise 'oh noes' end
def test_true; assert true end
end

test_name = 'test_true'
fr = FakeRunner.new

test = tc.new test_name
test.run fr
klass, name, exception = *fr.puked.first

assert_equal tc, klass
assert_equal test_name, name
assert_equal 'oh noes', exception.message
def test_callback_with_exception
tc = Class.new(TestCase) do
setup :bad_callback
def bad_callback; raise 'oh noes' end
def test_true; assert true end
end

def test_teardown_callback_with_exception
tc = Class.new(TestCase) do
teardown :bad_callback
def bad_callback; raise 'oh noes' end
def test_true; assert true end
end
test_name = 'test_true'
fr = FakeRunner.new

test_name = 'test_true'
fr = FakeRunner.new
test = tc.new test_name
test.run fr
klass, name, exception = *fr.puked.first

test = tc.new test_name
test.run fr
klass, name, exception = *fr.puked.first
assert_equal tc, klass
assert_equal test_name, name
assert_equal 'oh noes', exception.message
end

assert_equal tc, klass
assert_equal test_name, name
assert_equal 'oh noes', exception.message
def test_teardown_callback_with_exception
tc = Class.new(TestCase) do
teardown :bad_callback
def bad_callback; raise 'oh noes' end
def test_true; assert true end
end

test_name = 'test_true'
fr = FakeRunner.new

test = tc.new test_name
test.run fr
klass, name, exception = *fr.puked.first

assert_equal tc, klass
assert_equal test_name, name
assert_equal 'oh noes', exception.message
end
end
end

0 comments on commit aec8172

Please sign in to comment.