Before we start testing, we’ll need to load RSpec, our testing library.
We’ll be talking about RSpec 3, which has some significant syntactical differences from previous versions. We’ll largely ignore those differences and focus on only the new syntax.
To add RSpec to a Rails project, add the rspec-rails gem to your Gemfile:
group :development, :test do
gem 'rspec-rails', '~> 3.1'
The rspec-rails gem depends on the rspec gem proper. The rspec gem is mostly a list of other dependencies where the real work gets done, including rspec-core, rspec-expectations, and rspec-mocks. Sometimes rspec and rspec-rails are updated separately; you might choose to explicitly specify both versions in the Gemfile. Also, rspec