-
-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add super
advice for hooks
#35
Conversation
README.adoc
Outdated
end | ||
---- | ||
|
||
# good |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you forgot to delete this.
README.adoc
Outdated
def setup | ||
stub_something | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bad case and the good case are the same. For POROs that are not inherited from Minitest::Test
, it may be clearer to remove them from the example code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed it.
|
||
def setup | ||
do_something | ||
super |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, as the example code, it may be better to set up the superclass first.
def setup
super
do_something
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated. I've also added a teardown
example as I believe that would typically be in the opposite order.
@@ -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]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be even clearer :-)
=== Hooks [[hooks]] | |
=== Lifecycle Hooks [[lifecycle-hooks]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered that, but the Minitest docs seem to indicate that 'lifecycle hooks' are things such as before_setup
and after_teardown
, which are "meant for library writers, NOT for regular test authors."
https://www.rubydoc.info/gems/minitest/5.9.1/Minitest/Test/LifecycleHooks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get it. Thank you for the explanation!
a6cd680
to
535301b
Compare
535301b
to
b348034
Compare
Thank you! |
As suggested by @koic in rubocop/rubocop-minitest#111