Skip to content

Commit

Permalink
Prevent the examples should all pass cuke step false positives.
Browse files Browse the repository at this point in the history
It did not actually verify that any examples were run, and lead
to a false positive cucumber scenario discovered by @shepmaster
in #769. The underlying assumption of "the examples should all pass"
is that there were actually examples.

I think "the process should succeed even though no examples were run"
is a better description of the case when there are no examples.
  • Loading branch information
myronmarston committed Jan 16, 2013
1 parent f983252 commit 27a89f6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion features/command_line/example_name_option.feature
Expand Up @@ -49,7 +49,7 @@ Feature: --example option

Scenario: no matches
When I run `rspec . --example nothing_like_this`
Then the examples should all pass
Then the process should succeed even though no examples were run

Scenario: match on one word
When I run `rspec . --example example`
Expand Down
2 changes: 1 addition & 1 deletion features/command_line/tag.feature
Expand Up @@ -29,7 +29,7 @@ Feature: --tag option

Scenario: filter examples with non-existent tag
When I run `rspec . --tag mytag`
And the examples should all pass
Then the process should succeed even though no examples were run

Scenario: filter examples with a simple tag
When I run `rspec . --tag focus`
Expand Down
3 changes: 1 addition & 2 deletions features/filtering/exclusion_filters.feature
Expand Up @@ -81,8 +81,7 @@ Feature: exclusion filters
end
"""
When I run `rspec ./spec/sample_spec.rb --format doc`
Then the output should match /All examples were filtered out/
And the examples should all pass
Then the process should succeed even though no examples were run
And the output should not contain "group 1"
And the output should not contain "group 2"

Expand Down
6 changes: 6 additions & 0 deletions features/step_definitions/additional_cli_steps.rb
Expand Up @@ -14,6 +14,12 @@

Then /^the example(?:s)? should(?: all)? pass$/ do
step %q{the output should contain "0 failures"}
step %q{the output should not contain "0 examples"}
step %q{the exit status should be 0}
end

Then /^the process should succeed even though no examples were run$/ do
step %q{the output should contain "0 examples, 0 failures"}
step %q{the exit status should be 0}
end

Expand Down

0 comments on commit 27a89f6

Please sign in to comment.