1 2 3 4 5 6 7 8 9 10 11
# Registers MiniTest::Unit to run tests at process exit
next if $! # don't run if there was an exception
exit_code = MiniTest::Unit.new.run(ARGV)
exit false if exit_code && exit_code != 0
} unless @@installed_at_exit
@@installed_at_exit = true
When digging around in the test/unit files, I found out how the test cases run when your just run the test files. Basically, test/unit relies on another set of test libs called Minitest. In Minitest, there’s a method called autorun that gets called inside of test/unit.rb. In it, it calls a kernel method hook, at_exit() that runs a MiniTest when it’s done loading all the code.
And here, reading at_exit() in the docs, all I could think of to put in there was just a line that says, “done!”
Back to work….