Permalink
Browse files

calling correct method on minitest for test name when teardown callba…

…ck fails
  • Loading branch information...
tenderlove committed Oct 4, 2010
1 parent a448e74 commit 8beb84fa3308e842815dc89bb2aa24abed1014ff
@@ -23,12 +23,12 @@ def run(runner)
run_callbacks :setup
result = super
rescue Exception => e
- result = runner.puke(self.class, self.__name__, e)
+ result = runner.puke(self.class, __name__, e)
ensure
begin
run_callbacks :teardown, :enumerator => :reverse_each
rescue Exception => e
- result = runner.puke(self.class, self.name, e)
+ result = runner.puke(self.class, __name__, e)
end
end
result
@@ -33,6 +33,25 @@ def test_true; assert true end
assert_equal test_name, name
assert_equal 'oh noes', exception.message
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 = 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
end

0 comments on commit 8beb84f

Please sign in to comment.