expected css "title" with text in capybara
capybara, rspec
Solution
Not sure which version of gems you are using but I ran into a similar instance where using :text failed but when I used :content it passed the test. I'm using rails 3.2.3, rspec-rails 2.9.0, capybara 1.1.2 and therubyracer gems on Ubuntu Lucid Lynx.
Try replacing
page.should have_selector("title", :text => "anything title")
with
page.should have_selector("title", :content => "anything title")
Problem
I am using capybara in place of webrat in rails. I have installed capybara and use gem 'capybara' in Gemfile. when I use ``` page.should have_selector("title", :text => "anything title") ``` it's give an error ``` Failure/Error: page.should have_selector("title", :text => "anything title") expected css "title" with text "anything title" to return something ``` test file is as below: ``` 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 ```