Używam kapibary zamiast Webrata w szynach. Zainstalowałem kapibarę i używam gem 'capybara' w Gemfile. kiedy używaćOczekiwany css "title" z tekstem w kapibarze
page.should have_selector("title", :text => "anything title")
to dać błąd
Failure/Error: page.should have_selector("title", :text => "anything title")
expected css "title" with text "anything title" to return something
plik testowy jest jak poniżej:
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
Czy wypróbowałeś 'save_and_open_page' tuż przed swoją asercją testową, aby zobaczyć, co myśli Capybara? – nmott