File: pending_examples.feature

package info (click to toggle)
ruby-rspec 3.13.0c0e0m0s1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,856 kB
  • sloc: ruby: 70,868; sh: 1,423; makefile: 99
file content (74 lines) | stat: -rw-r--r-- 2,977 bytes parent folder | download
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
Feature: Using `pending` with examples

  RSpec offers a number of different ways to indicate that an example is
  disabled pending some action.

  Scenario: `pending` any arbitrary reason with a failing example
    Given a file named "pending_without_block_spec.rb" with:
      """ruby
      RSpec.describe "an example" do
        it "is implemented but waiting" do
          pending("something else getting finished")
          fail
        end
      end
      """
    When I run `rspec pending_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:
      """
      Pending: (Failures listed here are expected and do not affect your suite's status)

        1) an example is implemented but waiting
           # something else getting finished
      """

  Scenario: `pending` any arbitrary reason with a passing example
    Given a file named "pending_with_passing_example_spec.rb" with:
      """ruby
      RSpec.describe "an example" do
        it "is implemented but waiting" do
          pending("something else getting finished")
          expect(1).to be(1)
        end
      end
      """
    When I run `rspec pending_with_passing_example_spec.rb`
    Then the exit status should not be 0
    And the output should contain "1 example, 1 failure"
    And the output should contain "FIXED"
    And the output should contain "Expected pending 'something else getting finished' to fail. No error was raised."
    And the output should contain "pending_with_passing_example_spec.rb:2"

  Scenario: `pending` for an example that is currently passing
    Given a file named "pending_with_passing_block_spec.rb" with:
      """ruby
      RSpec.describe "an example" do
        pending("something else getting finished") do
          expect(1).to eq(1)
        end
      end
      """
    When I run `rspec pending_with_passing_block_spec.rb`
    Then the exit status should not be 0
    And the output should contain "1 example, 1 failure"
    And the output should contain "FIXED"
    And the output should contain "Expected pending 'No reason given' to fail. No error was raised."
    And the output should contain "pending_with_passing_block_spec.rb:2"

  Scenario: `pending` for an example that is currently passing with a reason
    Given a file named "pending_with_passing_block_spec.rb" with:
      """ruby
      RSpec.describe "an example" do
        example("something else getting finished", :pending => 'unimplemented') do
          expect(1).to eq(1)
        end
      end
      """
    When I run `rspec pending_with_passing_block_spec.rb`
    Then the exit status should not be 0
    And the output should contain "1 example, 1 failure"
    And the output should contain "FIXED"
    And the output should contain "Expected pending 'unimplemented' to fail. No error was raised."
    And the output should contain "pending_with_passing_block_spec.rb:2"