Since upgrading to Capybara 2.4, I\'ve been running into this issue. Previously, this block worked fine:
page.document.synchronize do
page.should have_no_c
The solution I've settled for is the following:
page.document.synchronize do
page.assert_no_selector('#ajax_indicator', :visible => true)
end
The assert_no_selector method properly throws a Capybara::ExpectationNotMet error and appears to work in the same way as has_no_css, so I'm satisfied with this solution.
I still have no idea why the RSpec error is being thrown for some methods but not others.
Edit: While this works it isn't actually a good idea to do so, see other responses.