Sha256: 4d498357f3ff94ea7c8cd21a3599d84f7927e9567a756f605d120e10110ecceb

Contents?: true

Size: 1.29 KB

Versions: 2

Compression:

Stored size: 1.29 KB

Contents

Feature: pattern option

  By default, RSpec loads files matching the pattern:

      "spec/**/*_spec.rb"

  Use the `--pattern` option to declare a different pattern.

  Scenario: default pattern
    Given a file named "spec/example_spec.rb" with:
      """ruby
      describe "addition" do
        it "adds things" do
          expect(1 + 2).to eq(3)
        end
      end
      """
    When I run `rspec`
    Then the output should contain "1 example, 0 failures"

  Scenario: override the default pattern on the command line
    Given a file named "spec/example.spec" with:
      """ruby
      describe "addition" do
        it "adds things" do
          expect(1 + 2).to eq(3)
        end
      end
      """
    When I run `rspec --pattern "spec/**/*.spec"`
    Then the output should contain "1 example, 0 failures"

  Scenario: override the default pattern in configuration
    Given a file named "spec/spec_helper.rb" with:
      """ruby
        RSpec.configure do |config|
          config.pattern << ',**/*.spec'
        end
      """
    And a file named "spec/example.spec" with:
      """ruby
      describe "addition" do
        it "adds things" do
          expect(1 + 2).to eq(3)
        end
      end
      """
    When I run `rspec -rspec_helper`
    Then the output should contain "1 example, 0 failures"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspec-core-3.0.0.beta2 features/command_line/pattern_option.feature
rspec-core-3.0.0.beta1 features/command_line/pattern_option.feature