[#1563] Add lien attestation link to closed mail template
This commit is contained in:
parent
abf938ff1b
commit
84c864ed11
2 changed files with 31 additions and 0 deletions
|
@ -49,6 +49,12 @@ module TagsSubstitutionConcern
|
|||
description: '',
|
||||
lambda: -> (d) { external_link(users_dossier_recapitulatif_url(d)) },
|
||||
available_for_states: Dossier::SOUMIS
|
||||
},
|
||||
{
|
||||
libelle: 'lien attestation',
|
||||
description: '',
|
||||
lambda: -> (d) { external_link(dossier_attestation_url(d)) },
|
||||
available_for_states: ['accepte']
|
||||
}
|
||||
]
|
||||
|
||||
|
|
|
@ -61,6 +61,31 @@ describe MailTemplateConcern do
|
|||
expect(received_mail.tags).to include(include({ libelle: 'date de passage en instruction' }))
|
||||
end
|
||||
end
|
||||
|
||||
describe '--lien attestation--' do
|
||||
let(:attestation_template) { AttestationTemplate.new(activated: true) }
|
||||
let(:procedure) { create(:procedure, attestation_template: attestation_template) }
|
||||
|
||||
subject { mail.body_for_dossier(dossier) }
|
||||
|
||||
before do
|
||||
dossier.attestation = dossier.build_attestation
|
||||
dossier.reload
|
||||
mail.body = "--lien attestation--"
|
||||
end
|
||||
|
||||
describe "in closed mail" do
|
||||
let(:mail) { create(:closed_mail, procedure: procedure) }
|
||||
|
||||
it { is_expected.to eq("<a target=\"_blank\" href=\"http://localhost:3000/dossiers/#{dossier.id}/attestation\">http://localhost:3000/dossiers/#{dossier.id}/attestation</a>") }
|
||||
end
|
||||
|
||||
describe "in refuse mail" do
|
||||
let(:mail) { create(:refused_mail, procedure: procedure) }
|
||||
|
||||
it { is_expected.to eq("--lien attestation--") }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#replace_tags' do
|
||||
|
|
Loading…
Reference in a new issue