require 'spec_helper'
describe PagesController do
render_views
describe "GET 'home'" do
it "returns http success" 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
以下代码但是当我运行rspec的投机/我有错误验证页面标题。我已经修改了home.html.erb这个
<!DOCTYPE html>
<html>
<head>
<title>Ruby on Rails Tutorial Sample App | Home</title>
</head>
<body>
<h1>Sample App Home Page</h1>
<p>Find me in app/views/pages/home.html.erb</p>
</body>
</html>
我有 rspec的版本2.13.0 水豚版本2.1.0
的可能的复制[验证页面标题与rspec](http://stackoverflow.com/questions/3971449/verifying-page-title-with-rspec) – 2016-02-13 13:35:05