I'm trying to make a test in rails using Rspec + Capybara + FactoryGirl.
In my page the user can click a link that is generated like this:
<a href="<%= email_path(emails: booking.dummy_user.email) %>" title="<%= t(".send_email") %>" id="send_email_dummy_<%= booking.dummy_user.id %>" >
<span class="icon-envelope"></span>
</a>
In my test I'm doing :
click_link "send_email_dummy_" + dummy_user.id.to_s
current_path.should eq(email_path(locale: "en", emails: dummy_user.email))
However instead of the test passing it is returning:
expected: "/en/email?emails=student%40email.com"
got: "/en/email"
I printed the page generated by the test and the link is correctly generated:
<a href="/en/email?emails=student%40email.com" title="Send Email" id="send_email_dummy_1" >
<span class="icon-envelope"></span>
</a>
Anyone has any idea why this might be happening?