Permalink
Browse files

- Fixed #passed? when used against a test that called flunk. (floehop…

…per)

[git-p4: depot-paths = "//src/minitest/dev/": change = 7647]
  • Loading branch information...
1 parent af527b2 commit c8283ff7e6ddf1ef23af9c3c0141a64735f74a9f @zenspider zenspider committed Jul 18, 2012
Showing with 29 additions and 0 deletions.
  1. +1 −0 lib/minitest/unit.rb
  2. +28 −0 test/minitest/test_minitest_unit.rb
View
1 lib/minitest/unit.rb
@@ -1070,6 +1070,7 @@ def run runner
rescue *PASSTHROUGH_EXCEPTIONS
raise
rescue Exception => e
+ @passed = false
result = runner.puke self.class, self.__name__, e
end
end
View
28 test/minitest/test_minitest_unit.rb
@@ -490,6 +490,34 @@ def test_omg; assert true; end
assert_equal expected, call_order
end
+ def test_teardown_with_successful_assertion
+ test_class = Class.new(MiniTest::Unit::TestCase) do
+ define_method :teardown do
+ assert true
+ end
+
+ def test_omg; assert true; end
+ end
+
+ test = test_class.new(:test_omg)
+ test.run(@tu)
+ assert test.passed?
+ end
+
+ def test_teardown_with_failing_assertion
+ test_class = Class.new(MiniTest::Unit::TestCase) do
+ define_method :teardown do
+ flunk
+ end
+
+ def test_omg; assert true; end
+ end
+
+ test = test_class.new(:test_omg)
+ test.run(@tu)
+ refute test.passed?
+ end
+
def test_after_teardown
call_order = []
Class.new(MiniTest::Unit::TestCase) do

0 comments on commit c8283ff

Please sign in to comment.