Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save rmanalan/159432 to your computer and use it in GitHub Desktop.

Select an option

Save rmanalan/159432 to your computer and use it in GitHub Desktop.
Cucumber step for testing text content inside a tag
# For testing text content within a tag. First param is a CSS3 selector,
# while second param is a regex
Then /^the "([^\"]*)" should have "([^\"]*)"$/ do |element,content|
response.body.should have_selector(element) do |node|
node.text.should =~ /#{content}/
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment