У меня возникли проблемы с Hartl в RoR Учебник Глава 5 Упражнение 1.Hartl RoR Учебник Глава 5 Упражнение 1: В противном случае тест: it_should_behave_like и should_not have_title
упражнение настраивает тест спецификации. приведенный в СПЕЦИФИЧЕСКОМ СПЕЦИАЛЕ ниже
Когда я запустил «bundle exec rspec spec/
», я получил ошибку, указанную в ОШИБКЕ ниже.
Если я закомментировать как:
it_should_behave_like "all static pages"
it { should_not have_title('| Home') }
тест проходит ...
ВОПРОС: Что случилось с it_should_behave_like
и 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
.......
.......
.......