fix: send confirmation email on re-adding agent (#5279)

Send confirmation email after re-adding the agent.

Fixes: #4951
This commit is contained in:
Tejaswini Chile
2022-08-18 13:12:43 +05:30
committed by GitHub
parent 0cd08065d1
commit ea918d9c5a
3 changed files with 21 additions and 2 deletions

View File

@@ -11,6 +11,7 @@ RSpec.describe 'Confirmation Instructions', type: :mailer do
before do
# to verify the token in email
confirmable_user.update!(confirmed_at: nil)
confirmable_user.send(:generate_confirmation_token)
end
@@ -61,5 +62,17 @@ RSpec.describe 'Confirmation Instructions', type: :mailer do
expect(confirmable_user.unconfirmed_email.blank?).to be false
end
end
context 'when user already confirmed' do
before do
confirmable_user.confirm
confirmable_user.account_users.last.destroy!
end
it 'send instructions with the link to login' do
confirmation_mail = Devise::Mailer.confirmation_instructions(confirmable_user.reload, nil, {})
expect(confirmation_mail.body).to include('/auth/sign_in')
end
end
end
end