OS Manuals

/usr/bin/rspec

BDD for Ruby. RSpec runner and example groups.

From ruby3.4-rspec-core 3.13.7-r0 (os), captured 2026-11-07 by running rspec --help (exit 0). permalink

Also provided by 1 other package version
Usage: rspec [options] [files or directories]

    -I PATH                            Specify PATH to add to $LOAD_PATH (may be used more than once).
    -r, --require PATH                 Require a file.
    -O, --options PATH                 Specify the path to a custom options file.
        --order TYPE[:SEED]            Run examples by the specified order type.
                                         [defined]           examples and groups are run in the order they are defined
                                         [rand]              randomize the order of groups and examples
                                         [random]            alias for rand
                                         [random:SEED]       e.g. --order random:123
                                         [recently-modified] run the most recently modified files first
        --seed SEED                    Equivalent of --order rand:SEED.
        --bisect[=verbose]             Repeatedly runs the suite in order to isolate the failures to the
                                         smallest reproducible case.
        --[no-]fail-fast[=COUNT]       Abort the run after a certain number of failures (1 by default).
        --failure-exit-code CODE       Override the exit code used when there are failing specs.
        --error-exit-code CODE         Override the exit code used when there are errors loading or running specs outside of examples.
    -X, --[no-]drb                     Run examples via DRb.
        --drb-port PORT                Port to connect to the DRb server.

  **** Output ****

    -f, --format FORMATTER             Choose a formatter.
                                         [p]rogress (default - dots)
                                         [d]ocumentation (group and example names)
                                         [h]tml
                                         [j]son
                                         [f]ailures ("file:line:reason", suitable for editors integration)
                                         custom formatter class name
    -o, --out FILE                     Write output to a file instead of $stdout. This option applies
                                         to the previously specified --format, or the default format
                                         if no format is specified.
        --deprecation-out FILE         Write deprecation warnings to a file instead of $stderr.
    -b, --backtrace                    Enable full backtrace.
        --force-color, --force-colour  Force the output to be in color, even if the output is not a TTY
        --no-color, --no-colour        Force the output to not be in color, even if the output is a TTY
    -p, --[no-]profile [COUNT]         Enable profiling of examples and list the slowest examples (default: 10).
        --dry-run                      Print the formatter output of your suite without
                                         running any examples or hooks
    -w, --warnings                     Enable ruby warnings

  **** Filtering/tags ****

    In addition to the following options for selecting specific files, groups, or
    examples, you can select individual examples by appending the line number(s) to
    the filename:

      rspec path/to/a_spec.rb:37:87

    You can also pass example ids enclosed in square brackets:

      rspec path/to/a_spec.rb[1:5,1:6] # run the 5th and 6th examples/groups defined in the 1st group

        --only-failures                Filter to just the examples that failed the last time they ran.
    -n, --next-failure                 Apply `--only-failures` and abort after one failure.
                                         (Equivalent to `--only-failures --fail-fast --order defined`)
    -P, --pattern PATTERN              Load files matching pattern (default: "spec/**/*_spec.rb").
        --exclude-pattern PATTERN      Load files except those matching pattern. Opposite effect of --pattern.
    -e, --example STRING               Run examples whose full nested names include STRING (may be
                                         used more than once)
    -E, --example-matches REGEX        Run examples whose full nested names match REGEX (may be
                                         used more than once)
    -t, --tag TAG[:VALUE]              Run examples with the specified tag, or exclude examples
                                       by adding ~ before the tag.
                                         - e.g. ~slow
                                         - TAG is always converted to a symbol
        --default-path PATH            Set the default path where RSpec looks for examples (can
                                         be a path to a file or a directory).

  **** Utility ****

        --init                         Initialize your project with RSpec.
    -v, --version                      Display the version.
    -h, --help                         You're looking at it.
Options (30)
OptionDescriptionSource
-I PATHSpecify PATH to add to $LOAD_PATH (may be used more than once).help
-r, --require PATHRequire a file.help
-O, --options PATHSpecify the path to a custom options file.help
--order TYPE[:SEEDRun examples by the specified order type.help
--seed SEEDEquivalent of --order rand:SEED.help
--bisect verboseRepeatedly runs the suite in order to isolate the failures to the smallest reproducible case.help
--failure-exit-code CODEOverride the exit code used when there are failing specs.help
--error-exit-code CODEOverride the exit code used when there are errors loading or running specs outside of examples.help
-XRun examples via DRb.help
--drb-port PORTPort to connect to the DRb server.help
-f, --format FORMATTERChoose a formatter.help
-o, --out FILEWrite output to a file instead of $stdout.help
--deprecation-out FILEWrite deprecation warnings to a file instead of $stderr.help
-b, --backtraceEnable full backtrace.help
--force-color, --force-colourForce the output to be in color, even if the output is not a TTYhelp
--no-color, --no-colourForce the output to not be in color, even if the output is a TTYhelp
-pEnable profiling of examples and list the slowest examples (default: 10).help
--dry-runPrint the formatter output of your suite without running any examples or hookshelp
-w, --warningsEnable ruby warningshelp
--only-failuresFilter to just the examples that failed the last time they ran.help
-n, --next-failureApply `--only-failures` and abort after one failure.help
-P, --pattern PATTERNLoad files matching pattern (default: "spec/**/*_spec.rb").help
--exclude-pattern PATTERNLoad files except those matching pattern.help
-e, --example STRINGRun examples whose full nested names include STRING (may be used more than once)help
-E, --example-matches REGEXRun examples whose full nested names match REGEX (may be used more than once)help
-t, --tag TAG[:VALUERun examples with the specified tag, or exclude examples by adding ~ before the tag.help
--default-path PATHSet the default path where RSpec looks for examples (can be a path to a file or a directory).help
--initInitialize your project with RSpec.help
-v, --versionDisplay the version.help
-h, --helpYou're looking at it.help

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.