Is there an alternative to RSpec\'s before(:suite)
and after(:suite)
in MiniTest?
I suspect that a custom test runner is in order, however
You can also add an after test callback by updating your test_helper.rb (or spec_helper.rb) like this
# test_helper.rb
class MyTest < Minitest::Unit
after_tests do
# ... after test code
end
end
As noted above in Caley's answer and comments, MiniTest::Unit
contains the function after_tests
. There is no before_tests
or equivalent, but any code in your minitest_helper.rb
file should be run before the test suite, so that will do the office of such a function.
Caveat: Still relatively new at Ruby, and very new at Minitest, so if I'm wrong, please correct me! :-)