RSpec
About
Documentation
Blog
Upgrade
Get Help
Contributing
Library:
RSpec Core
RSpec Core
RSpec Expectations
RSpec Mocks
RSpec Rails
Version:
3.12
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
Using the `--order` option
Run with `ruby` command
`--warnings` option (run with warnings enabled)
`--init` option
`--example-matches` option
Bisect
Using the `--only-failures` option
`--fail-fast` option
`--dry-run` option
Randomization can be reproduced across test runs
`--pattern` option
`--require` option
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
Using the `--pattern` option
Using `run_all_when_everything_filtered`
Overriding global ordering
Profiling examples (`--profile`)
Setting an error exit code
Setting a failure exit code
Setting the `--order` and/or `--seed`
Using the `--exclude_pattern` option
Global namespace DSL
Custom deprecation stream
Custom output stream
Excluding lines from the backtrace
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
Subject
Topics
Implicitly defined subject
Explicit Subject
One-liner syntax