Sha256: 41d575e73c3323fdb9610719bf371ce917e1e25f6880d62f4cd6e33b11e5eb55

Contents?: true

Size: 1.77 KB

Versions: 27

Compression:

Stored size: 1.77 KB

Contents

Feature: fail fast

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

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

  Background:
    Given a file named "spec/spec_helper.rb" with:
      """
      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:
      """
      describe "something" do
        it "passes" do
        end

        it "passes too" do
        end
      end
      """
    When I run "rspec spec/example_spec.rb"
    Then the output should contain "2 examples, 0 failures"

  Scenario: fail_fast with first example failing (only runs the one example)
    Given a file named "spec/example_spec.rb" with:
      """
      require "spec_helper"
      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:
      """
      require "spec_helper"
      describe "something" do
        it "passes" do
        end

        it "fails" do
          fail
        end
      end

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

      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

27 entries across 27 versions & 3 rubygems

Version Path
vim-jar-0.1.2.0001 bundler/ruby/1.8/gems/rspec-core-2.1.0/features/configuration/fail_fast.feature
rspec-core-2.4.0 features/configuration/fail_fast.feature
vim-jar-0.1.2 bundler/ruby/1.8/gems/rspec-core-2.1.0/features/configuration/fail_fast.feature
vim-jar-0.1.1 bundler/ruby/1.8/gems/rspec-core-2.1.0/features/configuration/fail_fast.feature
vim-jar-0.1.0 bundler/ruby/1.8/gems/rspec-core-2.1.0/features/configuration/fail_fast.feature
rspec-core-2.3.1 features/configuration/fail_fast.feature
rspec-core-2.3.0 features/configuration/fail_fast.feature
vim-jar-0.0.3 bundler/ruby/1.8/gems/rspec-core-2.1.0/features/configuration/fail_fast.feature
rspec-core-2.2.1 features/configuration/fail_fast.feature
vim-jar-0.0.2 bundler/ruby/1.8/gems/rspec-core-2.1.0/features/configuration/fail_fast.feature
vim-jar-0.0.1 bundler/ruby/1.8/gems/rspec-core-2.1.0/features/configuration/fail_fast.feature
rspec-core-2.2.0 features/configuration/fail_fast.feature
rspec-core-2.1.0 features/configuration/fail_fast.feature
rspec-core-2.0.1 features/configuration/fail_fast.feature
gemrage-1.0.0 vendor/ruby/1.8/gems/rspec-core-2.0.0/features/configuration/fail_fast.feature
gemrage-0.4.1 vendor/ruby/1.8/gems/rspec-core-2.0.0/features/configuration/fail_fast.feature
gemrage-0.4.0 vendor/ruby/1.8/gems/rspec-core-2.0.0/features/configuration/fail_fast.feature
gemrage-0.3.2 vendor/ruby/1.8/gems/rspec-core-2.0.0/features/configuration/fail_fast.feature
gemrage-0.3.1 vendor/ruby/1.8/gems/rspec-core-2.0.0/features/configuration/fail_fast.feature
gemrage-0.3.0 vendor/ruby/1.8/gems/rspec-core-2.0.0/features/configuration/fail_fast.feature