rspec/rspec-rails — Issue #478: have_selector :content doesn't work with capybara
Author: jwow313
Created: 2012-01-09 05:15:48+00:00
State: open

I'm finding that have_selector doesn't behave as described in the documentation (http://rubydoc.info/gems/rspec-rails/frames). I'm using rspec with capybara, and while have_selector correctly fails when provided tags are missing, it doesn't fail for any content passed as a secondary requirement.

For example:
it "should load acceptance page after login" do
visit "/"
u = Factory.create(:user)
fill_in "user[email]", :with => 'jason1@test.com'
fill_in "user[password]", :with => 'lada123'
click_button "Sign in"

page.should have_selector("p.notice", :content => "Signed in") # this shouldn't and doesn't fail
page.should have_content("XYZABC") # this fails
page.should have_selector("p.notice", :content => "XYZABC") # this should but doesn't fail

Note: I'm using rails 3.1.1, rspec-rails 2.7.0, capybara 1.1.1, and I'm doing require 'capybara/rspec' in my spec_helper.