Skip to content

Instantly share code, notes, and snippets.

@diasjorge
Created February 3, 2010 15:02
Show Gist options
  • Save diasjorge/293663 to your computer and use it in GitHub Desktop.
Save diasjorge/293663 to your computer and use it in GitHub Desktop.
Then /^I should( not)? see a link to (.+)(?: with text "([^\"]*)")?$/ do |do_not, page_name, text|
url = path_to(page_name)
selector = "a:match_href('#{url}')"
if do_not
response_body.should_not have_selector(selector, :handler => CustomHandler::MatchHref.new)
else
response_body.should have_selector(selector, :handler => CustomHandler::MatchHref.new) do |element|
if text
element.should contain(text)
else
true
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment