Installing RSpec

Learn how to install RSpec.

RSpec Gemfile

Before we start testing, we’ll need to load RSpec, our testing library.

To add RSpec to a Rails project, we’ll add the rspec-rails gem to the Gemfile:

Press + to interact
group :development, :test do
gem "rspec-rails"
end

The rspec-rails gem dependencies

The Rspec gem is mostly a list of other dependencies where the real work gets done, including:

  • The RSpec-core dependency
  • The rspec-expectations dependency
  • The rspec-mocks dependency

Sometimes rspec and rspec-rails are updated separately. We might choose to specify both ...