diff --git a/README.adoc b/README.adoc index b3b558c..cd357f9 100644 --- a/README.adoc +++ b/README.adoc @@ -480,6 +480,47 @@ _ { raise_exception }.must_raise TypeError Check the http://docs.seattlerb.org/minitest/Minitest/Expectations.html[Minitest::Expectations doc] for more information about its usage. +=== Hooks [[hooks]] + +If using a module containing `setup` or `teardown` methods, be sure to call `super` in the test class `setup` or +`teardown`. + +[source,ruby] +---- +# bad +module MyHelper + def setup + stub_something + end +end + +class TestMeme < Minitest::Test + include MyHelper + + def setup + do_something + end +end + +# good +module MyHelper + def setup + stub_something + end +end + +class TestMeme < Minitest::Test + include MyHelper + + def setup + do_something + super + end +end +---- + +# good + == Related Guides * https://rubystyle.guide[Ruby Style Guide]