I want to verify that a link with a specific href exists on a page. I am currently doing I should see "/some-link-here" but that seems to fail. How can I make sure that link exists without having to do click + I should be on "/some-link-here" page?
You will need to add custom step
Then /^"([^\"]*)" should link to "([^\"]*)"(?: within "([^\"]*)")$/ do |link_text,
page_name, container|
with_scope(container) do
URI.parse(page.find_link(link_text)['href']).path.should == path_to(page_name)
end
end
You can use the step like Then "User Login" should link to "the user_login page", user_login is the name of your route
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With