rspec Installing RSpec


The most common way to install the RSpec gem is using Bundler. Add this line to your application's Gemfile:

gem 'rspec'

And then execute bundle to install the dependencies:

$ bundle

Alternatively, you can install the gem manually:

$ gem install rspec

After installing the gem, run the following command:

rspec --init

This will create a spec folder for your tests, along with the following config files:

  • a spec directory into which to put spec files
  • a spec/spec_helper.rb file with default configuration options
  • an .rspec file with default command-line flags