| 1 |
Feature: `--dry-run` option |
| 2 |
|
| 3 |
Use the `--dry-run` option to have RSpec print your suite's formatter output |
| 4 |
without running any examples or hooks. |
| 5 |
|
| 6 |
Scenario: Using `--dry-run` |
| 7 |
Given a file named "spec/dry_run_spec.rb" with: |
| 8 |
"""ruby |
| 9 |
RSpec.configure do |c| |
| 10 |
c.before(:suite) { puts "before suite" } |
| 11 |
c.after(:suite) { puts "after suite" } |
| 12 |
end |
| 13 |
|
| 14 |
RSpec.describe "dry run" do |
| 15 |
before(:context) { fail } |
| 16 |
before(:example) { fail } |
| 17 |
|
| 18 |
it "fails in example" do |
| 19 |
fail |
| 20 |
end |
| 21 |
|
| 22 |
after(:example) { fail } |
| 23 |
after(:context) { fail } |
| 24 |
end |
| 25 |
""" |
| 26 |
When I run `rspec --dry-run` |
| 27 |
Then the output should contain "1 example, 0 failures" |
| 28 |
And the output should not contain "before suite" |
| 29 |
And the output should not contain "after suite" |