[Fix #3356] Add tags for primary menu only / secondary menu only

This commit is contained in:
Frederic Merizen 2019-02-05 16:31:23 +01:00 committed by simon lehericey
parent d3498e10bd
commit a3d7c8de55
2 changed files with 62 additions and 0 deletions

View file

@ -110,6 +110,40 @@ describe TagsSubstitutionConcern, type: :model do
end
end
context 'when the procedure has a linked drop down menus type de champ' do
let(:types_de_champ) do
[
create(:type_de_champ_linked_drop_down_list, libelle: 'libelle')
]
end
let(:template) { 'tout : --libelle--, primaire : --libelle/primaire--, secondaire : --libelle/secondaire--' }
context 'and the champ has no value' do
it { is_expected.to eq('tout : , primaire : , secondaire : ') }
end
context 'and the champ has a primary value' do
before do
c = dossier.champs.detect { |champ| champ.libelle == 'libelle' }
c.primary_value = 'primo'
c.save
end
it { is_expected.to eq('tout : primo / , primaire : primo, secondaire : ') }
end
context 'and the champ has a primary and secondary value' do
before do
c = dossier.champs.detect { |champ| champ.libelle == 'libelle' }
c.primary_value = 'primo'
c.secondary_value = 'secundo'
c.save
end
it { is_expected.to eq('tout : primo / secundo, primaire : primo, secondaire : secundo') }
end
end
context 'when the dossier has a motivation' do
let(:dossier) { create(:dossier, motivation: 'motivation') }