Sha256: 1ae38cd74bc8d8a5088e690a7a24b69aad2f08a990d77fda03f8860dec584638

Contents?: true

Size: 1.33 KB

Versions: 5

Compression:

Stored size: 1.33 KB

Contents

Feature: error exit code

  Use the `error_exit_code` option to set a custom exit code when RSpec fails outside an example.

  ```ruby
  RSpec.configure { |c| c.error_exit_code = 42 }
  ```

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

  Scenario: A erroring spec with the default exit code
    Given a file named "spec/typo_spec.rb" with:
      """ruby
      RSpec.escribe "something" do # intentional typo
        it "works" do
          true
        end
      end
      """
    When I run `rspec spec/typo_spec.rb`
    Then the exit status should be 1

  Scenario: A erroring spec with a custom exit code
    Given a file named "spec/typo_spec.rb" with:
      """ruby
      require 'spec_helper'
      RSpec.escribe "something" do # intentional typo
        it "works" do
          true
        end
      end
      """
    When I run `rspec spec/typo_spec.rb`
    And  the exit status should be 42


  Scenario: Success running specs spec with a custom error exit code defined
    Given a file named "spec/example_spec.rb" with:
      """ruby
      require 'spec_helper'
      RSpec.describe "something" do
        it "works" do
          true
        end
      end
      """
    When I run `rspec spec/example_spec.rb`
    Then the exit status should be 0

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
opal-rspec-1.1.0.alpha3 rspec-core/upstream/features/configuration/error_exit_code.feature
opal-rspec-1.1.0.alpha2 rspec-core/upstream/features/configuration/error_exit_code.feature
opal-rspec-1.1.0.alpha1 rspec-core/upstream/features/configuration/error_exit_code.feature
opal-rspec-1.0.0 rspec-core/upstream/features/configuration/error_exit_code.feature
opal-rspec-1.0.0.alpha1 rspec-core/upstream/features/configuration/error_exit_code.feature