the html I have is generated by ruby with:
<%= link_to "change", "http://gravatar.com/emails" %>
which results in:
<a href="http://gravatar.com/emails">change</a>
but I want to ensure that the link opens in a new tab with the
target="blank"
attribute
the rspec test looks like:
it { should have_link('change', href: 'http://gravatar.com/emails', target: '_blank') }
but the test still passes when I don't have the target attribute being generated.
The following works for me with capybara 1.1.2:
it { should have_selector("a[href='http://gravatar.com/emails'][target='_blank']") }
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