mailers: turn revert_to_instruction into a notification email
This commit is contained in:
parent
19e07b0cbf
commit
aa1cf6788b
3 changed files with 26 additions and 3 deletions
|
@ -60,8 +60,13 @@ class DossierMailer < ApplicationMailer
|
|||
|
||||
def notify_revert_to_instruction(dossier)
|
||||
@dossier = dossier
|
||||
@subject = "Votre dossier nº #{@dossier.id} est en train d'être réexaminé"
|
||||
@service = dossier.procedure.service
|
||||
@logo_url = attach_logo(dossier.procedure)
|
||||
|
||||
mail(to: dossier.user.email, subject: @subject)
|
||||
subject = "Votre dossier nº #{@dossier.id} est en train d'être réexaminé"
|
||||
|
||||
mail(from: NO_REPLY_EMAIL, to: dossier.user.email, subject: subject) do |format|
|
||||
format.html { render layout: 'mailers/notifications_layout' }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
- content_for :procedure_logo do
|
||||
= render 'layouts/mailers/logo', url: @logo_url
|
||||
|
||||
%p
|
||||
Bonjour,
|
||||
|
||||
|
@ -13,4 +16,7 @@
|
|||
email:
|
||||
= mail_to @dossier.procedure.service.email, @dossier.procedure.service.email
|
||||
|
||||
= render partial: "layouts/mailers/signature"
|
||||
= render 'layouts/mailers/signature'
|
||||
|
||||
- content_for :footer do
|
||||
= render 'layouts/mailers/service_footer', service: @service, dossier: @dossier
|
||||
|
|
|
@ -67,4 +67,16 @@ RSpec.describe DossierMailer, type: :mailer do
|
|||
it { expect(subject.body).to include("n'a pas pu être supprimé") }
|
||||
it { expect(subject.body).to include(dossier.procedure.libelle) }
|
||||
end
|
||||
|
||||
describe '.notify_revert_to_instruction' do
|
||||
let(:dossier) { create(:dossier, procedure: build(:simple_procedure)) }
|
||||
|
||||
subject { described_class.notify_revert_to_instruction(dossier) }
|
||||
|
||||
it { expect(subject.subject).to include('réexaminé') }
|
||||
it { expect(subject.body).to include(dossier.procedure.libelle) }
|
||||
it { expect(subject.body).to include(dossier_url(dossier)) }
|
||||
|
||||
it_behaves_like 'a dossier notification'
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue