jnicklas/capybara — Issue #604: have_text example in documentation does not work
Author: mipearson
Created: 2012-01-10 04:47:15+00:00
State: open

In the AJAX section:

find('#sidebar').find('h1').should have_text('Something')

a variant of this:

find('#title').should have_text(@advert.title)

Gives me

undefined method `has_text?' for # (NoMethodError)

Appending puts above it shows that the element is found and that it has text.

Investigation of the API docs shows that `Capybara::Node::Element` does not mix in `Matchers`, hence no `has_text?` method.

Workaround is `find(#title).text.should include?(@advert.title)`

Using REE 1.8.7, Rails 3.0.11, Capybara 1.1.1, rack-test 0.5.7, Cucumber 1.1.4