Reputation: 1211
I use Capybara 2.0.2 and Rspec 2.10.0 to test page title:
page.should have_selector('title', :text => 'Page title')
But it's doesn't work. Can anyone help me?
Upvotes: 0
Views: 836
Reputation: 16793
I had the same issue and ended up writing my own matcher to make it work.
See StackOverflow Q&A RSpec & Capybara 2.0 tripping up my have_selector tests for details and interesting discussion around the matter.
Upvotes: 1
Reputation: 4636
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.
Try replacing
page.should have_selector('title', :text => 'Page title')
with
page.should have_selector("title", :content => "Page title")
Upvotes: 0