Issue #4658 has been updated by Ryan Davis.


I can't replicate with ruby 1.8 or 1.9.2:


    require 'rubygems'
    gem 'minitest' # ensure latest gem in 1.9
    require 'minitest/autorun'

    class TestX < MiniTest::Unit::TestCase
      def test_x
        flunk
      end
    end

    MiniTest::Unit.after_tests do
      p :woot
    end

exits 1

----------------------------------------
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