[Fix #3578] No tags for champs that cannot have user input anyway

This commit is contained in:
Frederic Merizen 2019-03-11 10:26:27 +01:00
parent 8626d0a055
commit b428406fc7
3 changed files with 18 additions and 1 deletions

View file

@ -1,2 +1,5 @@
class TypesDeChamp::ExplicationTypeDeChamp < TypesDeChamp::TextTypeDeChamp
def tags_for_template
[]
end
end

View file

@ -1,2 +1,5 @@
class TypesDeChamp::HeaderSectionTypeDeChamp < TypesDeChamp::TypeDeChampBase
def tags_for_template
[]
end
end

View file

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