RSpec
About
Documentation
Blog
Upgrade
Get Help
Contributing
Library:
RSpec Core
RSpec Core
RSpec Expectations
RSpec Mocks
RSpec Rails
Version:
3.12
3.13
3.12
Example groups
The basic structure (`describe`/`it`)
Using shared examples
Using `shared_context`
Aliasing
Command line
`--example` option
`--format` option
`--tag` option
`<file>:<line_number>` (line number appended to file path)
`--failure-exit-code` option (exit status)
`--order` option
Creating a rake task
Bisect
`--dry-run` option
`--example-matches` option
`--fail-fast` option
`--init` option
Using the `--only-failures` option
Using the `--order` option
`--pattern` option
Randomization can be reproduced across test runs
`--require` option
Run with `ruby` command
`--warnings` option (run with warnings enabled)
Pending and skipped examples
Using `pending` with examples
Using `skip` with examples
Hooks
`before` and `after` hooks
`around` hooks
Filtering
Using `when_first_matching_example_defined` hook
Subject
Implicitly defined subject
Explicit Subject
One-liner syntax
Helper methods
`let` and `let!`
Defining arbitrary helper methods
Define helper methods in a module
Metadata
Using the current example
Using `described_class`
User-defined metadata
`RSpec` provides the current scope as `RSpec.current_scope`
Filtering
Inclusion filters
Exclusion filters
Conditional Filters
Using `filter_run_when_matching`
Configuration
Reading command line configuration options from files
Windows may require additional solutions to display color
Setting the `fail_fast` option
Setting the `fail_if_no_examples` option
Custom settings
Create example aliases
Setting the default spec path
Excluding lines from the backtrace
Custom deprecation stream
Global namespace DSL
Setting an error exit code
Using the `--exclude_pattern` option
Setting a failure exit code
Setting the `--order` and/or `--seed`
Custom output stream
Overriding global ordering
Using the `--pattern` option
Profiling examples (`--profile`)
Using `run_all_when_everything_filtered`
Zero monkey patching mode
Expectation framework integration
Configuring an expectation framework
Aggregating Failures
Mock framework integration
Mocking with `rspec`
Mocking with `flexmock`
Mocking with `mocha`
Mocking with `rr`
Mocking with an alternative framework
Formatters
Configurable colors
The JSON formatter
Custom formatters
Spec files
Using an arbitrary file suffix
Core standalone
Clear examples
Expectation framework integration
Topics
Configuring an expectation framework
Aggregating Failures