[#1563] Include attestation link in default closed mail when it makes sense
This commit is contained in:
parent
db0937d1eb
commit
3e56b6fe9b
3 changed files with 57 additions and 1 deletions
|
@ -5,9 +5,17 @@ module Mails
|
|||
belongs_to :procedure
|
||||
|
||||
SLUG = "closed_mail"
|
||||
DEFAULT_TEMPLATE_NAME = "mails/closed_mail"
|
||||
DISPLAYED_NAME = "Accusé d'acceptation"
|
||||
DEFAULT_SUBJECT = 'Votre dossier demarches-simplifiees.fr nº --numéro du dossier-- a été accepté'
|
||||
DOSSIER_STATE = 'accepte'
|
||||
|
||||
def self.default_template_name_for_procedure(procedure)
|
||||
attestation_template = procedure.attestation_template
|
||||
if attestation_template.present? && attestation_template.activated?
|
||||
"mails/closed_mail_with_attestation"
|
||||
else
|
||||
"mails/closed_mail"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
22
app/views/mails/closed_mail_with_attestation.html.haml
Normal file
22
app/views/mails/closed_mail_with_attestation.html.haml
Normal file
|
@ -0,0 +1,22 @@
|
|||
Bonjour,
|
||||
%br
|
||||
%br
|
||||
Votre dossier nº --numéro du dossier-- a été accepté le --date de décision--.
|
||||
%br
|
||||
%br
|
||||
Vous pouvez télécharger votre attestation à l'adresse suivante : --lien attestation--
|
||||
%br
|
||||
%br
|
||||
A tout moment, vous pouvez consulter le contenu de vos dossiers et les éventuels commentaires de l'administration à cette adresse : --lien dossier--
|
||||
%br
|
||||
%br
|
||||
Bonne journée,
|
||||
%br
|
||||
%br
|
||||
L'équipe demarches-simplifiees.fr (anciennement Téléprocédures Simplifiées)
|
||||
%br
|
||||
%br
|
||||
—
|
||||
%br
|
||||
%br
|
||||
Merci de ne pas répondre à cet email. Postez directement vos questions dans votre dossier sur la plateforme.
|
|
@ -41,6 +41,32 @@ describe Procedure do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'closed mail template body' do
|
||||
let(:procedure) { create(:procedure) }
|
||||
|
||||
subject { procedure.closed_mail_template.body }
|
||||
|
||||
context 'for procedures without an attestation' do
|
||||
it { is_expected.not_to include('lien attestation') }
|
||||
end
|
||||
|
||||
context 'for procedures with an attestation' do
|
||||
before { create(:attestation_template, procedure: procedure, activated: activated) }
|
||||
|
||||
context 'when the attestation is inactive' do
|
||||
let(:activated) { false }
|
||||
|
||||
it { is_expected.not_to include('lien attestation') }
|
||||
end
|
||||
|
||||
context 'when the attestation is inactive' do
|
||||
let(:activated) { true }
|
||||
|
||||
it { is_expected.to include('lien attestation') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'validation' do
|
||||
context 'libelle' do
|
||||
it { is_expected.not_to allow_value(nil).for(:libelle) }
|
||||
|
|
Loading…
Reference in a new issue