ruby - How to run code before each test case in all tests in MiniTest? -
i need run code before each test in tests in minitest.
before did:
minitest::unit::testcase.add_setup_hook ...code run before each test end
after upgraded minitest version 4.7.2 shows following error:
undefined method `add_setup_hook' minitest::unit::testcase:class (nomethoderror)
i using ruby mri 2.0.0p0.
solution
module myminitestplugin def before_setup super # ...code run before test cases end def after_teardown # ... code run after test cases super end end class minitest::unit::testcase include myminitestplugin end
add_setup_hook
removed in 4.6.0. https://github.com/seattlerb/minitest/commit/792a480ebeb32983b9150adae575b7c396e2ae63
use before_setup
instead.
Comments
Post a Comment