-
Notifications
You must be signed in to change notification settings - Fork 16
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 support for multiple examples per code object #3
Conversation
The failing Cucumber test is due to a change in Minitest: "Add encoding information when test fails." minitest/minitest#620. Let me know if you want me to update the Cucumber expectation in this PR. |
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 new identifier is the spec method name generated by Minitest::Spec. This makes it very simple to match hooks to failing tests, all you need to do is copy the name from the Minitest output.
Maybe it's better to just use example name in this case?
@flag = true | ||
end | ||
|
||
YARD::Doctest.before('#flag#test_0001_Second example for flag') do |
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.
What do you think if we use a different notation, e.g. #flag@Second example for flag
? I feel like #test_0001_
in is implementation detail provided by Minitest.
I'm good to merge this anyways if you don't like the proposed changes.
That would be great! |
Thanks for the PR! I'm definitely ready to merge it, but I'll wait until you answer to my comments above. |
Great suggestion for the notation, it is much cleaner. (Should I also add an example to the README?) I'll update the PR later today with both changes. |
286754c
to
80af343
Compare
I'll add new hooks to README, create CHANGELOG and release new version today. Thanks again for PR! |
Released in 0.1.6 |
👏🏻 |
@p0deje Thank you! googleapis/google-cloud-ruby#901 is the beginning of our effort to test all of the google-cloud doc examples (current count: 772) with yard-doctest. Thank you very much for creating and maintaining it! |
@quartzmo Thank you for using it! It's really cool to build something that is used by Google. |
This PR adds support for writing specific before/after hooks when there are multiple examples per code object (example from google-cloud-ruby) by increasing the detail in the identifier passed to
register_hooks
.Some notes:
include?
on the hook name, backwards-compatibility is maintained for less-specific hook names (all Cucumber tests pass.)I'm happy to make any edits/changes, just let me know!
/cc @blowmage