[#1110] Port libellé procédure tag from mail templates

This commit is contained in:
Frederic Merizen 2018-01-04 10:54:50 +01:00
parent ee109b24e3
commit ad0462f7ff
2 changed files with 8 additions and 0 deletions

View file

@ -25,6 +25,7 @@ module TagsSubstitutionConcern
{ libelle: 'date de décision',
description: 'Date de la décision dacceptation, refus, ou classement sans suite',
lambda: -> (d) { d.processed_at.present? ? d.processed_at.localtime.strftime('%d/%m/%Y') : '' } },
{ libelle: 'libellé procédure', description: '', lambda: -> (d) { d.procedure.libelle } },
{ libelle: 'numéro du dossier', description: '', target: :id }]
end

View file

@ -5,6 +5,7 @@ describe TagsSubstitutionConcern, type: :model do
let(:procedure) do
create(:procedure,
libelle: 'Une magnifique procédure',
types_de_champ: types_de_champ,
types_de_champ_private: types_de_champ_private,
for_individual: for_individual)
@ -172,6 +173,12 @@ describe TagsSubstitutionConcern, type: :model do
it { is_expected.to eq(DateTime.now.localtime.strftime('%d/%m/%Y')) }
end
context "when the template has a libellé procédure tag" do
let(:template) { 'body --libellé procédure--' }
it { is_expected.to eq('body Une magnifique procédure') }
end
context "match breaking and non breaking spaces" do
before { dossier.champs.first.update_attributes(value: 'valeur') }