Merge pull request #3579 from betagouv/frederic/fix_3578-no_tags_for_static_champs
[Fix #3578] No tags for champs that cannot have user input anyway
This commit is contained in:
commit
b9146b8892
3 changed files with 18 additions and 1 deletions
|
@ -1,2 +1,5 @@
|
||||||
class TypesDeChamp::ExplicationTypeDeChamp < TypesDeChamp::TextTypeDeChamp
|
class TypesDeChamp::ExplicationTypeDeChamp < TypesDeChamp::TextTypeDeChamp
|
||||||
|
def tags_for_template
|
||||||
|
[]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,2 +1,5 @@
|
||||||
class TypesDeChamp::HeaderSectionTypeDeChamp < TypesDeChamp::TypeDeChampBase
|
class TypesDeChamp::HeaderSectionTypeDeChamp < TypesDeChamp::TypeDeChampBase
|
||||||
|
def tags_for_template
|
||||||
|
[]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -321,9 +321,20 @@ describe TagsSubstitutionConcern, type: :model do
|
||||||
describe 'tags' do
|
describe 'tags' do
|
||||||
subject { template_concern.tags }
|
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é')] }
|
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
|
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: 'motivation' })) }
|
||||||
it { is_expected.to include(include({ libelle: 'date de décision' })) }
|
it { is_expected.to include(include({ libelle: 'date de décision' })) }
|
||||||
|
|
Loading…
Reference in a new issue