Sha256: caa116eccdb8ec3da8ce7d2403b925d8e03f8064b9f4a312391562d141427cd7

Contents?: true

Size: 1.83 KB

Versions: 7

Compression:

Stored size: 1.83 KB

Contents

Feature: fail fast

  Use the `fail_fast` option to tell RSpec to abort the run on first failure:

  ```ruby
  RSpec.configure { |c| c.fail_fast = true }
  ```

  Background:
    Given a file named "spec/spec_helper.rb" with:
      """ruby
      RSpec.configure {|c| c.fail_fast = true}
      """

  Scenario: `fail_fast` with no failures (runs all examples)
    Given a file named "spec/example_spec.rb" with:
      """ruby
      RSpec.describe "something" do
        it "passes" do
        end

        it "passes too" do
        end
      end
      """
    When I run `rspec spec/example_spec.rb`
    Then the examples should all pass

  Scenario: `fail_fast` with first example failing (only runs the one example)
    Given a file named "spec/example_spec.rb" with:
      """ruby
      require "spec_helper"
      RSpec.describe "something" do
        it "fails" do
          fail
        end

        it "passes" do
        end
      end
      """
    When I run `rspec spec/example_spec.rb -fd`
    Then the output should contain "1 example, 1 failure"

  Scenario: `fail_fast` with multiple files, second example failing (only runs the first two examples)
    Given a file named "spec/example_1_spec.rb" with:
      """ruby
      require "spec_helper"
      RSpec.describe "something" do
        it "passes" do
        end

        it "fails" do
          fail
        end
      end

      RSpec.describe "something else" do
        it "fails" do
          fail
        end
      end
      """
    And a file named "spec/example_2_spec.rb" with:
      """ruby
      require "spec_helper"
      RSpec.describe "something" do
        it "passes" do
        end
      end

      RSpec.describe "something else" do
        it "fails" do
          fail
        end
      end
      """
    When I run `rspec spec`
    Then the output should contain "2 examples, 1 failure"

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
opal-rspec-0.8.0 rspec-core/upstream/features/configuration/fail_fast.feature
opal-rspec-0.8.0.alpha3 rspec-core/upstream/features/configuration/fail_fast.feature
opal-rspec-0.8.0.alpha2 rspec-core/upstream/features/configuration/fail_fast.feature
opal-rspec-0.8.0.alpha1 rspec-core/upstream/features/configuration/fail_fast.feature
opal-rspec-0.7.1 rspec-core/upstream/features/configuration/fail_fast.feature
opal-rspec-0.7.0 rspec-core/upstream/features/configuration/fail_fast.feature
opal-rspec-0.7.0.rc.2 rspec-core/upstream/features/configuration/fail_fast.feature