Using rspec-rails

Once rspec-rails is installed, you’ll be able to run your spec suite using either bundle exec rspec or bin/rake spec. Commands in the bin directory, like rake or rails, are Rails-generated binstubs (wrapper scripts) that save you the hassle of remembering to type bundle exec before every command.[127]

If you’re used to creating binstubs via Bundler’s --binstubs option as described in Bundler, be aware that this option may not play nicely with Spring, a Rails preloader designed to speed up boot times.[128] You may see Rails commands hang or print warning messages from the Bundler-generated binstubs. To solve the problem, you’ll need to either remove Spring or switch to the binstubs provided by Rails:

 $ ​​bundle config --delete ...

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.