From 0fbbe4d97c75ef6527ccde79b97aff12bdafa743 Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 16 Feb 2024 10:32:44 +0100 Subject: [PATCH] bug(tags): libelle with double dash, double dash also known as tag delimiter --- .../concern/tags_substitution_concern_spec.rb | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/spec/models/concern/tags_substitution_concern_spec.rb b/spec/models/concern/tags_substitution_concern_spec.rb index 842429b79..6dbc7c869 100644 --- a/spec/models/concern/tags_substitution_concern_spec.rb +++ b/spec/models/concern/tags_substitution_concern_spec.rb @@ -203,6 +203,28 @@ describe TagsSubstitutionConcern, type: :model do end end + context 'when the procedure has a type de champ with double dash (--)' do + let(:types_de_champ_public) do + [ + { libelle: "bon pote -- c'est top" } + ] + end + + context 'and they are used in the template' do + let(:template) { "--bon pote -- c'est top--" } + + context 'and their value in the dossier are not nil' do + before do + dossier.champs_public + .find { |champ| champ.libelle == "bon pote -- c'est top" } + .update(value: 'ceci est mon évènement') + end + + it { is_expected.to eq('ceci est mon évènement') } + end + end + end + context 'when the procedure has a type de champ repetition' do let(:template) { '--Répétition--' } let(:types_de_champ_public) { [{ type: :repetition, libelle: 'Répétition', mandatory: true, children: [{ libelle: 'Nom' }, { libelle: 'Prénom' }] }] }