I'm following the older version (for Rails 3) of Michael Hartl's Rails screencasts. However, I'm using Ruby 2 with Rails 4 (
rspec-rails 3.0.1), interpolating between the lessons and practice via Google searches.
I'm stuck with a possibly wrong matcher. Here is my failing spec:
RSpec.describe PagesController do render_views it "has the correct page title" do get 'home' expect(response).to have_selector('title') end end end
Here's the error message:
Failures: 1) PagesController GET 'home' has the correct page title Failure/Error: expect(response).to have_selector('title') expected #<ActionController::TestResponse:0x9e1202c> to respond to `has_selector?` # ./spec/controllers/pages_controller_spec.rb:13:in `block (3 levels) in <top (required)>' # -e:1:in `<main>'
It seems that there is no such matcher as have_selector in
rspec-rails3. I've looked it up on their Github page there seems to be no mention of this matcher.
source 'https://rubygems.org' ruby '2.0.0' gem 'rails', '4.0.0' gem 'sqlite3' gem 'sass-rails', '~> 4.0.0' gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.0.0' gem 'jquery-rails' gem 'turbolinks' gem 'jbuilder' group :doc do gem 'sdoc', require: false end group :development do gem 'spring-commands-rspec' end group :development, :test do gem 'rspec' gem 'rspec-rails' end