Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

have_text example in documentation does not work #604

Closed
mipearson opened this issue Jan 10, 2012 · 1 comment
Closed

have_text example in documentation does not work #604

mipearson opened this issue Jan 10, 2012 · 1 comment

Comments

@mipearson
Copy link

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 #<Capybara::Node::Element:0x12fca4e98> (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

@mipearson
Copy link
Author

Er, oops. Turns out that's in master, and not in the gem version.

joliss added a commit to joliss/capybara that referenced this issue Jan 10, 2012
This way users of Capybara 1.1.2 will not be confused. We could start
preferring has_text in the README once 2.0.0 is out.

@hardbap in teamcapybara#580 and @mipearson in teamcapybara#604 ran into this -- thanks to
both for the reports!
@lock lock bot locked and limited conversation to collaborators Aug 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant