Merge pull request #10009 from mfo/US/tag-with-double-dash

correctif(tags): ETQ admin, les champs contenant deux '-' successif ne pouvaient etre utilisé dans les attestations & mail
This commit is contained in:
mfo 2024-02-16 13:11:21 +00:00 committed by GitHub
commit 7fb8e2e967
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 0 deletions

View file

@ -19,6 +19,7 @@ module TagsSubstitutionConcern
.sub(/[[:space:]]+$/, '')
.gsub(/[[:space:]]/, ' ')
.gsub(' ', ' ')
.gsub(/--/, '__')
end
define_combinator :doc do

View file

@ -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' }] }] }