When I have links that open a new window / tab, I usually configure it to open in the same window for the test environment. I created this method for my application helper:
def link_target
%[target="#{Rails.env.test? ? "_self" : "_blank"}"]
end
And inside my markup:
<a href="/path" <%= link_target %>>Click here</a>
source
share