Module: Minitest::Test::LifecycleHooks
- Included in:
- Minitest::Test
- Defined in:
- lib/minitest/test.rb
Overview
Provides before/after hooks for setup and teardown. These are meant for library writers, NOT for regular test authors. See #before_setup for an example.
Instance Method Summary collapse
-
#after_setup ⇒ Object
Runs before every test, after setup.
-
#after_teardown ⇒ Object
Runs after every test, after teardown.
-
#before_setup ⇒ Object
Runs before every test, before setup.
-
#before_teardown ⇒ Object
Runs after every test, before teardown.
-
#setup ⇒ Object
Runs before every test.
-
#teardown ⇒ Object
Runs after every test.
Instance Method Details
#after_setup ⇒ Object
Runs before every test, after setup. This hook is meant for libraries to extend minitest. It is not meant to be used by test developers.
See #before_setup for an example.
162 |
# File 'lib/minitest/test.rb', line 162 def after_setup; end |
#after_teardown ⇒ Object
Runs after every test, after teardown. This hook is meant for libraries to extend minitest. It is not meant to be used by test developers.
See #before_setup for an example.
186 |
# File 'lib/minitest/test.rb', line 186 def after_teardown; end |
#before_setup ⇒ Object
Runs before every test, before setup. This hook is meant for libraries to extend minitest. It is not meant to be used by test developers.
As a simplistic example:
module MyMinitestPlugin
def before_setup
super
# ... stuff to do before setup is run
end
def after_setup
# ... stuff to do after setup is run
super
end
def before_teardown
super
# ... stuff to do before teardown is run
end
def after_teardown
# ... stuff to do after teardown is run
super
end
end
class Minitest::Test
include MyMinitestPlugin
end
147 |
# File 'lib/minitest/test.rb', line 147 def before_setup; end |
#before_teardown ⇒ Object
Runs after every test, before teardown. This hook is meant for libraries to extend minitest. It is not meant to be used by test developers.
See #before_setup for an example.
171 |
# File 'lib/minitest/test.rb', line 171 def before_teardown; end |
#setup ⇒ Object
Runs before every test. Use this to set up before each test run.
153 |
# File 'lib/minitest/test.rb', line 153 def setup; end |
#teardown ⇒ Object
Runs after every test. Use this to clean up after each test run.
177 |
# File 'lib/minitest/test.rb', line 177 def teardown; end |