diff --git a/app/models/types_de_champ/explication_type_de_champ.rb b/app/models/types_de_champ/explication_type_de_champ.rb index d0ce5aeb0..f2f32ec97 100644 --- a/app/models/types_de_champ/explication_type_de_champ.rb +++ b/app/models/types_de_champ/explication_type_de_champ.rb @@ -1,2 +1,5 @@ class TypesDeChamp::ExplicationTypeDeChamp < TypesDeChamp::TextTypeDeChamp + def tags_for_template + [] + end end diff --git a/app/models/types_de_champ/header_section_type_de_champ.rb b/app/models/types_de_champ/header_section_type_de_champ.rb index d81baca29..c686d9372 100644 --- a/app/models/types_de_champ/header_section_type_de_champ.rb +++ b/app/models/types_de_champ/header_section_type_de_champ.rb @@ -1,2 +1,5 @@ class TypesDeChamp::HeaderSectionTypeDeChamp < TypesDeChamp::TypeDeChampBase + def tags_for_template + [] + end end diff --git a/spec/models/concern/tags_substitution_concern_spec.rb b/spec/models/concern/tags_substitution_concern_spec.rb index ad495ba2b..4b5a1ef21 100644 --- a/spec/models/concern/tags_substitution_concern_spec.rb +++ b/spec/models/concern/tags_substitution_concern_spec.rb @@ -321,9 +321,20 @@ describe TagsSubstitutionConcern, type: :model do describe 'tags' do subject { template_concern.tags } - let(:types_de_champ) { [create(:type_de_champ, libelle: 'public')] } + let(:types_de_champ) do + [ + create(:type_de_champ, libelle: 'public'), + create(:type_de_champ_header_section, libelle: 'entête de section'), + create(:type_de_champ_explication, libelle: 'explication') + ] + end let(:types_de_champ_private) { [create(:type_de_champ, :private, libelle: 'privé')] } + context 'do not generate tags for champs that cannot have usager content' do + it { is_expected.not_to include(include({ libelle: 'entête de section' })) } + it { is_expected.not_to include(include({ libelle: 'explication' })) } + end + context 'when generating a document for a dossier terminé' do it { is_expected.to include(include({ libelle: 'motivation' })) } it { is_expected.to include(include({ libelle: 'date de décision' })) }