Last active
October 13, 2015 13:59
-
-
Save sirbrillig/4206735 to your computer and use it in GitHub Desktop.
RSpec have_link_to matcher
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
RSpec::Matchers.define :have_link_to do |expected| | |
match do |actual| | |
actual.has_xpath?("//a[@href=\"#{expected}\"]") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Alternatively, just use have_link('', href: somepath).