rspec
Run and execute RSpec tests
TLDR
Initialize an .rspec configuration and a spec helper file
Run all tests
Run a specific directory of tests
Run one or more test files
Run a specific test in a file (e.g. the test starts on line 83)
Run specs with a specific seed
SYNOPSIS
rspec [options] [files or directories]
PARAMETERS
--version
Displays the RSpec version.
--help
Displays help information about the command and its options.
--format FORMAT
Specifies the formatter to use (e.g., `progress`, `documentation`).
--color
Enables colorized output.
--no-color
Disables colorized output.
--fail-fast
Stop after the first failure.
--profile
Displays the slowest examples and example groups.
[files or directories]
Specifies the files or directories containing RSpec tests to run.
DESCRIPTION
The `rspec` command is used to execute RSpec tests for Ruby projects. RSpec is a behavior-driven development (BDD) testing framework for Ruby. The `rspec` command interprets test specifications written in RSpec syntax and reports on the success or failure of each test. It provides a flexible and extensible environment for writing expressive and maintainable tests. It can execute specific test files, directories, or run all tests in a project. It supports various options for controlling test execution, formatting output, and integrating with other tools. The output usually shows which tests passed and failed, any errors or exceptions raised during testing, and provides helpful debugging information.
CAVEATS
Requires Ruby and the RSpec gem to be installed. Configuration files (e.g., `.rspec`) can impact default behavior. Test execution can be resource-intensive for large test suites.
CONFIGURATION FILES
RSpec often uses a configuration file (e.g., `.rspec`, `spec_helper.rb`) to set up the testing environment and configure options. These files can influence the default behavior of the `rspec` command. Common configurations include loading support libraries, defining global helpers, and setting formatting preferences.