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
added --dry-run option #1028
added --dry-run option #1028
Conversation
@@ -107,7 +107,7 @@ def run(example_group_instance, reporter) | |||
start(reporter) | |||
|
|||
begin | |||
unless pending | |||
unless pending or RSpec.configuration.dry_run |
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.
This is very strongly opinionated so feel free to disagree with me better, but as conditionals get more complex I like turn them into ifs instead of unlesses. What do you think?
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 am totally ok with changing this to "if". I realize that coming from a mathematics background, DeMorgan's rules are pretty hard-wired into my brain...
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.
Or extract the condition out into a will_execute? method?
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.
Normally I would agree with you @samphippen, especially if there's an else
but I try to stick to the cleaner version and
unless pending or RSpec.configuration.dry_run
reads better than
if !(pending or RSpec.configuration.dry_run)
if !pending and !RSpec.configuration.dry_run
You can add specs to this in You will also need to add a |
I think this implementation will still run |
Correct. Argh. More research. |
I think I got it. Should probably move tests around after I realized before/after(:all) block execution is a group thing. And please nitpick if you see things you don't like. |
|
||
Scenario: Using --dry-run | ||
When I run `rspec . --dry-run` | ||
Then the examples should all pass |
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 it would be better to assert on the output here, to give an example of what to expect, and I'm not sure we should be considering the tests as "passing" here. They're closer to being pending.
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 would rather write something like "Then it looks like the tests are all passing" with the same assertion underneath.
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 test's don't pass though, they don't even run, so to describe it as such is misleading in my opinion
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 see. Would "Then it looks like the tests are all passing" solve that? Do you have a better suggestion?
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.
Actually showing the output you expect, similar to how pending does it /features/pending/pending_examples.feature#L17
Edit (is what I suggest :) )
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.
|
||
Scenario: Using --dry-run | ||
When I run `rspec . --dry-run` | ||
Then the output should contain "5 examples, 0 failures" |
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.
Nice work on the compacting, although I'd be tempted to use one liners for the hooks; Also this should now be "1 example"
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.
Oh my. Blanked on that. Will fix it tonight.
LGTM, but we'll wait until @myronmarston returns to merge this I think |
Cool! Let me know if you want me to squash the commits. |
Thanks for your contribution, @schnittchen! I merged it, and then built off of this to add a few further improvements: #1056. |
This adds --dry-run support as requested in #1022.
I would need some help as to where to test this feature...