1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
Feature: `skip` examples
RSpec offers a number of ways to indicate that an example should be skipped
and not executed.
Scenario: No implementation provided
Given a file named "example_without_block_spec.rb" with:
"""ruby
RSpec.describe "an example" do
it "is a skipped example"
end
"""
When I run `rspec example_without_block_spec.rb`
Then the exit status should be 0
And the output should contain "1 example, 0 failures, 1 pending"
And the output should contain "Not yet implemented"
And the output should contain "example_without_block_spec.rb:2"
Scenario: Skipping using `skip`
Given a file named "skipped_spec.rb" with:
"""ruby
RSpec.describe "an example" do
skip "is skipped" do
end
end
"""
When I run `rspec skipped_spec.rb`
Then the exit status should be 0
And the output should contain "1 example, 0 failures, 1 pending"
And the output should contain:
"""
Pending: (Failures listed here are expected and do not affect your suite's status)
1) an example is skipped
# No reason given
# ./skipped_spec.rb:2
"""
Scenario: Skipping using `skip` inside an example
Given a file named "skipped_spec.rb" with:
"""ruby
RSpec.describe "an example" do
it "is skipped" do
skip
end
end
"""
When I run `rspec skipped_spec.rb`
Then the exit status should be 0
And the output should contain "1 example, 0 failures, 1 pending"
And the output should contain:
"""
Pending: (Failures listed here are expected and do not affect your suite's status)
1) an example is skipped
# No reason given
# ./skipped_spec.rb:2
"""
Scenario: Temporarily skipping by prefixing `it`, `specify`, or `example` with an x
Given a file named "temporarily_skipped_spec.rb" with:
"""ruby
RSpec.describe "an example" do
xit "is skipped using xit" do
end
xspecify "is skipped using xspecify" do
end
xexample "is skipped using xexample" do
end
end
"""
When I run `rspec temporarily_skipped_spec.rb`
Then the exit status should be 0
And the output should contain "3 examples, 0 failures, 3 pending"
And the output should contain:
"""
Pending: (Failures listed here are expected and do not affect your suite's status)
1) an example is skipped using xit
# Temporarily skipped with xit
# ./temporarily_skipped_spec.rb:2
2) an example is skipped using xspecify
# Temporarily skipped with xspecify
# ./temporarily_skipped_spec.rb:5
3) an example is skipped using xexample
# Temporarily skipped with xexample
# ./temporarily_skipped_spec.rb:8
"""
Scenario: Skipping using metadata
Given a file named "skipped_spec.rb" with:
"""ruby
RSpec.describe "an example" do
example "is skipped", :skip => true do
end
end
"""
When I run `rspec skipped_spec.rb`
Then the exit status should be 0
And the output should contain "1 example, 0 failures, 1 pending"
And the output should contain:
"""
Pending: (Failures listed here are expected and do not affect your suite's status)
1) an example is skipped
# No reason given
# ./skipped_spec.rb:2
"""
|