| 1 |
Feature: Using `pending` with examples |
| 2 |
|
| 3 |
RSpec offers a number of different ways to indicate that an example is |
| 4 |
disabled pending some action. |
| 5 |
|
| 6 |
Scenario: `pending` any arbitrary reason with a failing example |
| 7 |
Given a file named "pending_without_block_spec.rb" with: |
| 8 |
"""ruby |
| 9 |
RSpec.describe "an example" do |
| 10 |
it "is implemented but waiting" do |
| 11 |
pending("something else getting finished") |
| 12 |
fail |
| 13 |
end |
| 14 |
end |
| 15 |
""" |
| 16 |
When I run `rspec pending_without_block_spec.rb` |
| 17 |
Then the exit status should be 0 |
| 18 |
And the output should contain "1 example, 0 failures, 1 pending" |
| 19 |
And the output should contain: |
| 20 |
""" |
| 21 |
Pending: (Failures listed here are expected and do not affect your suite's status) |
| 22 |
|
| 23 |
1) an example is implemented but waiting |
| 24 |
# something else getting finished |
| 25 |
""" |
| 26 |
|
| 27 |
Scenario: `pending` any arbitrary reason with a passing example |
| 28 |
Given a file named "pending_with_passing_example_spec.rb" with: |
| 29 |
"""ruby |
| 30 |
RSpec.describe "an example" do |
| 31 |
it "is implemented but waiting" do |
| 32 |
pending("something else getting finished") |
| 33 |
expect(1).to be(1) |
| 34 |
end |
| 35 |
end |
| 36 |
""" |
| 37 |
When I run `rspec pending_with_passing_example_spec.rb` |
| 38 |
Then the exit status should not be 0 |
| 39 |
And the output should contain "1 example, 1 failure" |
| 40 |
And the output should contain "FIXED" |
| 41 |
And the output should contain "Expected pending 'something else getting finished' to fail. No error was raised." |
| 42 |
And the output should contain "pending_with_passing_example_spec.rb:2" |
| 43 |
|
| 44 |
Scenario: `pending` for an example that is currently passing |
| 45 |
Given a file named "pending_with_passing_block_spec.rb" with: |
| 46 |
"""ruby |
| 47 |
RSpec.describe "an example" do |
| 48 |
pending("something else getting finished") do |
| 49 |
expect(1).to eq(1) |
| 50 |
end |
| 51 |
end |
| 52 |
""" |
| 53 |
When I run `rspec pending_with_passing_block_spec.rb` |
| 54 |
Then the exit status should not be 0 |
| 55 |
And the output should contain "1 example, 1 failure" |
| 56 |
And the output should contain "FIXED" |
| 57 |
And the output should contain "Expected pending 'No reason given' to fail. No error was raised." |
| 58 |
And the output should contain "pending_with_passing_block_spec.rb:2" |
| 59 |
|
| 60 |
Scenario: `pending` for an example that is currently passing with a reason |
| 61 |
Given a file named "pending_with_passing_block_spec.rb" with: |
| 62 |
"""ruby |
| 63 |
RSpec.describe "an example" do |
| 64 |
example("something else getting finished", :pending => 'unimplemented') do |
| 65 |
expect(1).to eq(1) |
| 66 |
end |
| 67 |
end |
| 68 |
""" |
| 69 |
When I run `rspec pending_with_passing_block_spec.rb` |
| 70 |
Then the exit status should not be 0 |
| 71 |
And the output should contain "1 example, 1 failure" |
| 72 |
And the output should contain "FIXED" |
| 73 |
And the output should contain "Expected pending 'unimplemented' to fail. No error was raised." |
| 74 |
And the output should contain "pending_with_passing_block_spec.rb:2" |