| 1 |
Feature: `--fail-fast` option |
| 2 |
|
| 3 |
Use the `--fail-fast` option to tell RSpec to stop running the test suite on |
| 4 |
the first failed test. |
| 5 |
|
| 6 |
You may add a parameter to tell RSpec to stop running the test suite after N |
| 7 |
failed tests, for example: `--fail-fast=3`. |
| 8 |
|
| 9 |
You can also specify `--no-fail-fast` to turn it off (default behaviour). |
| 10 |
|
| 11 |
Background: |
| 12 |
Given a file named "fail_fast_spec.rb" with: |
| 13 |
"""ruby |
| 14 |
RSpec.describe "fail fast" do |
| 15 |
it "passing test" do; end |
| 16 |
it "1st failing test" do |
| 17 |
fail |
| 18 |
end |
| 19 |
it "2nd failing test" do |
| 20 |
fail |
| 21 |
end |
| 22 |
it "3rd failing test" do |
| 23 |
fail |
| 24 |
end |
| 25 |
it "4th failing test" do |
| 26 |
fail |
| 27 |
end |
| 28 |
it "passing test" do; end |
| 29 |
end |
| 30 |
""" |
| 31 |
|
| 32 |
Scenario: Using `--fail-fast` |
| 33 |
When I run `rspec . --fail-fast` |
| 34 |
Then the output should contain ".F" |
| 35 |
Then the output should not contain ".F." |
| 36 |
|
| 37 |
Scenario: Using `--fail-fast=3` |
| 38 |
When I run `rspec . --fail-fast=3` |
| 39 |
Then the output should contain ".FFF" |
| 40 |
Then the output should not contain ".FFFF." |
| 41 |
|
| 42 |
Scenario: Using `--no-fail-fast` |
| 43 |
When I run `rspec . --no-fail-fast` |
| 44 |
Then the output should contain ".FFFF." |