Created
December 2, 2011 22:21
-
-
Save stevenharman/1425103 to your computer and use it in GitHub Desktop.
Using Capybara 1.1.2, "session#has_text?" doesn't exist?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'spec_helper' | |
| # spec/acceptance/thing_spec.rb | |
| feature "Viewing a thing" do | |
| let(:thing) { Factory.create(:thing, name: "I'm a thing!") } | |
| scenario "show a summary of the thing" do | |
| visit thing_path(thing) | |
| page.should have_text "I'm a thing!" | |
| end | |
| end | |
| # Failures: | |
| # | |
| # 1) Viewing a thing show a summary of the thing | |
| # Failure/Error: page.should have_text "I'm a thing!" | |
| # NoMethodError: | |
| # undefined method `has_text?' for #<Capybara::Session> |
Author
If you want to stick with capybara 1.1.2 (latest release, for now), use #has_content? instead. It is mostly the same, but will also successfully match on text which isn't visible.
page.should have_content "I'm a thing!"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Figured it out.
Capybara::Session#has_text?hasn't yet been released. For now I'm just going right to GitHubgem 'capybara', git: 'https://github.com/jnicklas/capybara.git'