私はと、ユーザーの最初の作成「レイアウトを埋める」と題し、第5章を完了したら、私はRSpecの走ったと私は、次の取得:マイケル・ハートルガイド第5章RSpecの問題
1) PagesController GET 'home' should have the right title
Failure/Error: response.should have_selector("title", :content => "Ruby on Rails Tutorial Sample App | Home")
expected following output to contain a <title>Ruby on Rails Tutorial Sample App | Home</title>
2) PagesController GET 'contact' should have the right title
Failure/Error: response.should have_selector("title", :content => "Ruby on Rails Tutorial Sample App | Contact")
expected following output to contain a <title>Ruby on Rails Tutorial Sample App | Contact</title>
3) PagesController GET 'about' should have the right title
Failure/Error: response.should have_selector("title", :content => "Ruby on Rails Tutorial Sample App | About")
expected following output to contain a <title>Ruby on Rails Tutorial Sample App | About</title>
私は私は何をしているのか分かりません。また、ページが完全に罰金起動するだけでなく
ここをPagesControllerコード は 'spec_helper'
describe PagesController do
render_views
describe "GET 'home'" do
it "should be successful" do
get 'home'
response.should be_success
end
it "should have the right title" do
get 'home'
response.should have_selector("title", :content => "Ruby on Rails Tutorial Sample App | Home")
end
end
describe "GET 'contact'" do
it "should be successful" do
get 'contact'
response.should be_success
end
it "should have the right title" do
get 'contact'
response.should have_selector("title", :content => "Ruby on Rails Tutorial Sample App | Contact")
end
end
describe "GET 'about'" do
it "should be successful" do
get 'about'
response.should be_success
end
it "should have the right title" do
get 'about'
response.should have_selector("title", :content => "Ruby on Rails Tutorial Sample App | About")
end
end
end
はまた、ここに私のアプリ/ビュー/レイアウト/ application.html.erb
<title><%= @title %></title>
がある必要されます
ここは私のlayout_links_specです
require 'spec_helper'
it "should have a Home page at '/'" do
get '/'
response.should have_selector('title', :content => "Home")
end
it "should have a Contact page at '/contact'" do
get '/contact'
response.should have_selector('title', :content => "Contact")
end
it "should have have an About page at '/about" do
get '/about'
response.should have_selector('title', :content => "About")
end
it "should have a Help pageat '/help'" do
get '/help'
response.should have_selector('title', :content => "Help")
end
it "should have a signup page at '/signup'" do
get '/signup'
response.should have_selector('title', :content => "Sign up")
end
it "should have the right links on the layout" do
visit root_path
response.should have_selector('title', :content => "Home")
end
end
この問題を引き起こしている第5章の関連コードまたは特定のセクションを表示してください。 –
マイコードが追加されました – matt