Command-Line Configuration

To see all the available command-line options, run rspec --help. You’ll get a pretty big list of settings, some of which you’ve already used in this book. We’re not going to go over them all here, but there are a few we’d like to highlight.

Environment Options

Sometimes, you need to control how RSpec loads your Ruby code. For instance, you may be experimenting with a locally modified version of a library—in that case, you’d want RSpec to load your custom version of that library instead of the default one.

The first two options listed in the --help output are for these kinds of environment customizations:

 -I PATH Specify PATH to add to $LOAD_PATH (may
  be used more than once).
 -r, --require PATH Require a file. ...

Get Effective Testing with RSpec 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.