bug(liens-invitation): ne devrait pas pointer sur l'avis ayant le même id que l'invitation
This commit is contained in:
parent
42f93e241f
commit
4f4791a864
2 changed files with 10 additions and 0 deletions
|
@ -51,6 +51,15 @@ RSpec.describe InviteMailer, type: :mailer do
|
|||
.from(0).to(1)
|
||||
end
|
||||
|
||||
context 'when an avis exists with same id' do
|
||||
it 'associate the TargetedUserLink to the good model [does not search by id only]' do
|
||||
avis = create(:avis, id: invite.id)
|
||||
link_on_avis_with_same_id = create(:targeted_user_link, target_model: avis, target_context: TargetedUserLink.target_contexts[:avis])
|
||||
deliver
|
||||
expect(invite.targeted_user_link).not_to eq(link_on_avis_with_same_id)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when it fails' do
|
||||
it 'creates only one target_user_link' do
|
||||
send_mail_values = [:raise, true]
|
||||
|
|
|
@ -61,6 +61,7 @@ describe 'Invitations' do
|
|||
|
||||
invitation_email = open_email(user.email)
|
||||
targeted_user_link = TargetedUserLink.last
|
||||
expect(targeted_user_link.user.email).to eq(user.email)
|
||||
expect(invitation_email).to have_link(targeted_user_link_url(targeted_user_link))
|
||||
invitation_email.click_on targeted_user_link_url(targeted_user_link)
|
||||
expect(page).to have_current_path("/users/sign_in")
|
||||
|
|
Loading…
Reference in a new issue