Permalink
Browse files

Prevent `the examples should all pass` cuke step false positives.

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...
1 parent f983252 commit 27a89f69f5aaff90ce82b8ccc171de6712084744 @myronmarston myronmarston committed Jan 16, 2013
@@ -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`
@@ -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`
@@ -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"
@@ -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

0 comments on commit 27a89f6

Please sign in to comment.