File: default_path.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 (37 lines) | stat: -rw-r--r-- 1,228 bytes parent folder | download | duplicates (4)
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
Feature: Setting the default spec path

  You can just type `rspec` to run all specs that live in the `spec` directory.

  This is supported by a `--default-path` option, which is set to `spec` by
  default. If you prefer to keep your specs in a different directory, or assign
  an individual file to `--default-path`, you can do so on the command line or
  in a configuration file (for example `.rspec`).

  **NOTE:** this option is not supported on `RSpec.configuration`, as it needs to be
  set before spec files are loaded.

  Scenario: Run `rspec` with default `default-path` (`spec` directory)
    Given a file named "spec/example_spec.rb" with:
      """ruby
      RSpec.describe "an example" do
        it "passes" do
        end
      end
      """
    When I run `rspec`
    Then the output should contain "1 example, 0 failures"

  Scenario: Run `rspec` with customized `default-path`
    Given a file named ".rspec" with:
      """
      --default-path behavior
      """
    Given a file named "behavior/example_spec.rb" with:
      """ruby
      RSpec.describe "an example" do
        it "passes" do
        end
      end
      """
    When I run `rspec`
    Then the output should contain "1 example, 0 failures"