I'm having problems with Hartl's RoR Tutorial Chapter 5 Exercise 1.
The exercise sets up the test spec. given in TEST SPEC below.
When I run "bundle exec rspec spec/
", I get the error given in ERROR below.
If I comment out both:
it_should_behave_like "all static pages"
it { should_not have_title('| Home') }
the test passes...
QUESTION: What's wrong with it_should_behave_like
and should_not have_title
**ERROR**
o DRb server is running. Running in local process instead ...
WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.7.8
F...F......
Failures:
1) Static pages Home page
Failure/Error: it { should_not have_title('| Home') }
NoMethodError:
undefined method `has_title?' for #<Capybara::Session>
# ./spec/requests/static_pages_spec.rb:18:in `block (3 levels) in <top (required)>'
**TEST SPEC**
require 'spec_helper'
describe "Static pages" do
subject { page }
shared_examples_for "all static pages" do
it { should have_content(heading) }
it { should have_title(full_title(page_title)) }
end
describe "Home page" do
before { visit root_path }
let(:heading) { 'Sample App' }
let(:page_title) { '' }
it_should_behave_like "all static pages"
it { should_not have_title('| Home') }
end
.......
.......
.......