File: exclude_pattern.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 (43 lines) | stat: -rw-r--r-- 1,589 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
Feature: Using the `--exclude_pattern` option

  Use the `--exclude-pattern` option to tell RSpec to skip looking for specs in files
  that match the pattern specified.

  Background:
    Given a file named "spec/models/model_spec.rb" with:
      """ruby
      RSpec.describe "two specs here" do
        it "passes" do
        end

        it "passes too" do
        end
      end
      """
    And a file named "spec/features/feature_spec.rb" with:
      """ruby
      RSpec.describe "only one spec" do
        it "passes" do
        end
      end
      """

  Scenario: By default, RSpec runs files that match `"**/*_spec.rb"`
   When I run `rspec`
   Then the output should contain "3 examples, 0 failures"

  Scenario: The `--exclude-pattern` flag makes RSpec skip matching files
   When I run `rspec --exclude-pattern "**/models/*_spec.rb"`
   Then the output should contain "1 example, 0 failures"

  Scenario: The `--exclude-pattern` flag can be used to pass in multiple patterns, separated by comma
   When I run `rspec --exclude-pattern "**/models/*_spec.rb, **/features/*_spec.rb"`
   Then the output should contain "0 examples, 0 failures"

  Scenario: The `--exclude-pattern` flag accepts shell style glob unions
   When I run `rspec --exclude-pattern "**/{models,features}/*_spec.rb"`
   Then the output should contain "0 examples, 0 failures"

  Scenario: The `--exclude-pattern` flag can be used with the `--pattern` flag
   When I run `rspec --pattern "spec/**/*_spec.rb" --exclude-pattern "spec/models/*_spec.rb"`
   Then the output should contain "1 example, 0 failures"