2019-07-09 17:08:27 +02:00
|
|
|
|
RSpec.describe UserMailer, type: :mailer do
|
|
|
|
|
let(:user) { build(:user) }
|
|
|
|
|
|
|
|
|
|
describe '.new_account_warning' do
|
|
|
|
|
subject { described_class.new_account_warning(user) }
|
|
|
|
|
|
|
|
|
|
it { expect(subject.to).to eq([user.email]) }
|
|
|
|
|
it { expect(subject.body).to include(user.email) }
|
2020-02-11 18:17:09 +01:00
|
|
|
|
it { expect(subject.body).to have_link('J’ai oublié mon mot de passe') }
|
|
|
|
|
|
|
|
|
|
context 'when a procedure is provided' do
|
|
|
|
|
let(:procedure) { build(:procedure) }
|
|
|
|
|
|
|
|
|
|
subject { described_class.new_account_warning(user, procedure) }
|
|
|
|
|
|
|
|
|
|
it { expect(subject.body).to have_link("Commencer la démarche « #{procedure.libelle} »", href: commencer_sign_in_url(path: procedure.path)) }
|
|
|
|
|
end
|
2019-07-09 17:08:27 +02:00
|
|
|
|
end
|
|
|
|
|
|
2021-10-26 13:36:14 +02:00
|
|
|
|
describe '.ask_for_merge' do
|
2019-07-09 17:08:27 +02:00
|
|
|
|
let(:requested_email) { 'new@exemple.fr' }
|
|
|
|
|
|
2021-10-26 13:36:14 +02:00
|
|
|
|
subject { described_class.ask_for_merge(user, requested_email) }
|
2019-07-09 17:08:27 +02:00
|
|
|
|
|
|
|
|
|
it { expect(subject.to).to eq([requested_email]) }
|
|
|
|
|
it { expect(subject.body).to include(requested_email) }
|
|
|
|
|
end
|
|
|
|
|
end
|