Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #38 from cameel/fix-minitest-run-monkeypatch-no-trace

Make Turn work with gems that monkey-patch MiniTest::Unit::TestCase.run()
  • Loading branch information...
commit c4314e7dbfb42d81472bd16c83d8334233b5cbb3 2 parents e65d213 + 8050407
@trans trans authored
Showing with 10 additions and 23 deletions.
  1. +10 −23 lib/turn/autorun/minitest.rb
View
33 lib/turn/autorun/minitest.rb
@@ -74,7 +74,7 @@ def run_test_suites(filter = /./)
@broken = nil
- @@out.print(case inst.run(self)
+ @@out.print(case run_testcase(inst, self)
when :pass
@broken = false
green { pad_with_size "PASS" }
@@ -150,28 +150,15 @@ def puke(klass, meth, e)
result
end
-
- class TestCase
- # Overwrite #run method so that is uses symbols
- # as return values rather than characters.
- def run(runner)
- result = :pass
- begin
- @passed = nil
- self.setup
- self.__send__ self.__name__
- @passed = true
- rescue Exception => e
- @passed = false
- result = runner.puke(self.class, self.__name__, e)
- ensure
- begin
- self.teardown
- rescue Exception => e
- result = runner.puke(self.class, self.__name__, e)
- end
- end
- result
+private
+ # A wrapper over MiniTest::Unit::TestCase.run() that returns
+ # :pass whenever the test succeeds (i.e. run() returns "" or ".")
+ def run_testcase(testcase, runner)
+ original_result = testcase.run(runner)
+ if original_result == "" || original_result == "."
+ :pass
+ else
+ original_result
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.