RailsのWebratの代わりにカピバラを使用しています。カピバラをインストールし、Gemfile で gem 'capybara' を使用しています。私が使うとき
page.should have_selector("title", :text => "anything title")
それはエラーを与える
Failure/Error: page.should have_selector("title", :text => "anything title")
expected css "title" with text "anything title" to return something
テストファイルは以下のとおりです。
require 'spec_helper'
describe "Test pages" do
describe "Home page" do
it "should have the content 'Demo App'" do
visit '/test_pages/home'
page.should have_selector("title", :text => "anything title")
end
end
end