Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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...
commit c8283ff7e6ddf1ef23af9c3c0141a64735f74a9f 1 parent af527b2
@zenspider zenspider authored
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
Please sign in to comment.
Something went wrong with that request. Please try again.