From 961c7c5be4330fa2e38e8033b426ec9b9c333909 Mon Sep 17 00:00:00 2001 From: Christophe Robillard Date: Tue, 5 Dec 2023 18:04:44 +0100 Subject: [PATCH] fix format for motivation in notification mail --- app/models/concerns/tags_substitution_concern.rb | 3 ++- spec/models/concern/tags_substitution_concern_spec.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/concerns/tags_substitution_concern.rb b/app/models/concerns/tags_substitution_concern.rb index 8a0b11dcf..8ded0c3e9 100644 --- a/app/models/concerns/tags_substitution_concern.rb +++ b/app/models/concerns/tags_substitution_concern.rb @@ -3,6 +3,7 @@ module TagsSubstitutionConcern include Rails.application.routes.url_helpers include ActionView::Helpers::UrlHelper + include ActionView::Helpers::TextHelper module TagsParser include Parsby::Combinators @@ -64,7 +65,7 @@ module TagsSubstitutionConcern id: 'dossier_motivation', libelle: 'motivation', description: 'Motivation facultative associée à la décision finale d’acceptation, refus ou classement sans suite', - target: :motivation, + lambda: -> (d) { simple_format(d.motivation) }, available_for_states: Dossier::TERMINE }, { diff --git a/spec/models/concern/tags_substitution_concern_spec.rb b/spec/models/concern/tags_substitution_concern_spec.rb index faa4cb187..405d743f4 100644 --- a/spec/models/concern/tags_substitution_concern_spec.rb +++ b/spec/models/concern/tags_substitution_concern_spec.rb @@ -240,7 +240,7 @@ describe TagsSubstitutionConcern, type: :model do context 'and the template has some dossier tags' do let(:template) { '--motivation-- --numéro du dossier--' } - it { is_expected.to eq("motivation #{dossier.id}") } + it { is_expected.to eq("

motivation

#{dossier.id}") } end end