require 'spec_helper'
describe "LayoutLinks" do
it "should have a Home page at '/'" do
get '/'
response.should have_selector('title', :content => "Home")
end
end
Спецификация источника: https://github.com/railstutorial/sample_app/blob/master/spec/requests/layout_links_spec.rb
(Я читаю книгу)
Я пытался поместить integrate_views и render_views, но он вернул неопределенную ошибку переменной.
$ guard
Guard is now watching at '[project dir]'
Guard::RSpec is running, with RSpec 2!
Running all specs
F
Failures:
1) LayoutLinks should have a Home page at '/'
Failure/Error: response.should have_selector('title', :content => "Home")
expected css "title" to return something
# ./spec/requests/layout_links_spec.rb:5:in `block (2 levels) in <top (required)>'
Finished in 13.15 seconds
1 example, 1 failure
Failed examples:
rspec ./spec/requests/layout_links_spec.rb:3 # LayoutLinks should have a Home page at '/'
Часть моего Gemfile:
gem 'rails', '3.1.0'
group :development, :test do
gem 'turn', :require => false
gem 'sqlite3'
gem "rspec-rails"
gem "factory_girl_rails"
gem "capybara"
gem "guard-rspec"
end
Для настройки всего, что я выполнил:
http://railscasts.com/episodes/275-how-i-test?view=asciicast
Часть моего корневого каталога: имеет тег заголовка и находится внутри "Name of Site | Home"