add warning in gi pages in rule does not match tdc

This commit is contained in:
Eric Leroy-Terquem 2023-05-15 11:40:03 +02:00 committed by LeSim
parent 6e88c49470
commit 50abf496fd
2 changed files with 46 additions and 1 deletions

View file

@ -60,6 +60,45 @@ describe Administrateurs::GroupeInstructeursController, type: :controller do
expect(assigns(:available_instructeur_emails)).to match_array(['instructeur_3@ministere-a.gouv.fr', 'instructeur_4@ministere-b.gouv.fr'])
end
end
context 'group without routing rule' do
before { get :show, params: { procedure_id: procedure.id, id: gi_1_1.id } }
it do
expect(response).to have_http_status(:ok)
expect(response.body).to include('à configurer')
end
end
context 'group with routing rule matching tdc' do
let!(:drop_down_tdc) { create(:type_de_champ_drop_down_list, procedure: procedure, drop_down_options: options) }
let(:options) { procedure.groupe_instructeurs.pluck(:label) }
before do
gi_1_1.update(routing_rule: ds_eq(champ_value(drop_down_tdc.stable_id), constant(gi_1_1.label)))
get :show, params: { procedure_id: procedure.id, id: gi_1_1.id }
end
it do
expect(response).to have_http_status(:ok)
expect(response.body).not_to include('à configurer')
end
end
context 'group with routing rule not matching tdc' do
let!(:drop_down_tdc) { create(:type_de_champ_drop_down_list, procedure: procedure, drop_down_options: options) }
let(:options) { ['parmesan', 'brie', 'morbier'] }
before do
gi_1_1.update(routing_rule: ds_eq(champ_value(drop_down_tdc.stable_id), constant(gi_1_1.label)))
get :show, params: { procedure_id: procedure.id, id: gi_1_1.id }
end
it do
expect(response).to have_http_status(:ok)
expect(response.body).to include('à configurer')
end
end
end
describe '#create' do