ajout d'une balise pour le nom du service

This commit is contained in:
clemkeirua 2019-02-20 11:48:08 +01:00 committed by Pierre de La Morinerie
parent 1f7d5b6541
commit 236f73f838
2 changed files with 16 additions and 1 deletions

View file

@ -40,6 +40,12 @@ module TagsSubstitutionConcern
description: '', description: '',
target: :id, target: :id,
available_for_states: Dossier::SOUMIS available_for_states: Dossier::SOUMIS
},
{
libelle: 'nom du service',
description: 'Le nom du service instructeur qui traite le dossier',
lambda: -> (d) { d.procedure.organisation_name || '' },
available_for_states: Dossier::SOUMIS
} }
] ]

View file

@ -4,12 +4,15 @@ describe TagsSubstitutionConcern, type: :model do
let(:for_individual) { false } let(:for_individual) { false }
let(:state) { Dossier.states.fetch(:accepte) } let(:state) { Dossier.states.fetch(:accepte) }
let(:service) { create(:service, nom: 'Service instructeur') }
let(:procedure) do let(:procedure) do
create(:procedure, create(:procedure,
libelle: 'Une magnifique démarche', libelle: 'Une magnifique démarche',
types_de_champ: types_de_champ, types_de_champ: types_de_champ,
types_de_champ_private: types_de_champ_private, types_de_champ_private: types_de_champ_private,
for_individual: for_individual) for_individual: for_individual,
service: service)
end end
let(:template_concern) do let(:template_concern) do
@ -144,6 +147,12 @@ describe TagsSubstitutionConcern, type: :model do
end end
end end
context 'when the dossier has a service' do
let(:template) { 'Dossier traité par --nom du service--' }
it { is_expected.to eq("Dossier traité par #{service.nom}") }
end
context 'when the dossier has a motivation' do context 'when the dossier has a motivation' do
let(:dossier) { create(:dossier, motivation: 'motivation') } let(:dossier) { create(:dossier, motivation: 'motivation') }