Issue #4658 has been updated by Ryan Davis.


Just in case a repro comes up, the above code doesn't cover all cases correctly. I'm currently going with:

    status = $!.respond_to?(:status) ? $!.status : ($! ? 1 : 0)

----------------------------------------
Bug #4658: Minitest - invalid return code when using MiniTest::Unit.after_tests
http://redmine.ruby-lang.org/issues/4658

Author: Robert Pankowecki
Status: Feedback
Priority: Normal
Assignee: Ryan Davis
Category: lib
Target version: 
ruby -v: ruby 1.9.2p136 (2010-12-25 revision 30365) [i686-linux]


If test fails and MiniTest::Unit.after_tests is used then the program returned code is 0 but it should not be.

Here is my current workaround:

MiniTest::Unit.after_tests do
  status = ($! && $!.respond_to?(:status) && $!.status) || 0
  # do something...
  exit(status)
end


-- 
http://redmine.ruby-lang.org