1

テスト用に次のコードがあります

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 spec/ を実行すると、ページ タイトルの検証でエラーが発生します。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 を持っています

4

1 に答える 1