chore(routing): cannot create simple_routing with champs communes or epcis
This commit is contained in:
parent
e40d1107ac
commit
2e547cd46f
2 changed files with 1 additions and 41 deletions
|
@ -43,7 +43,7 @@ module Administrateurs
|
|||
tdc = @procedure.active_revision.routable_types_de_champ.find { |tdc| tdc.stable_id == stable_id }
|
||||
|
||||
case tdc.type_champ
|
||||
when TypeDeChamp.type_champs.fetch(:communes), TypeDeChamp.type_champs.fetch(:departements), TypeDeChamp.type_champs.fetch(:epci)
|
||||
when TypeDeChamp.type_champs.fetch(:departements)
|
||||
tdc_options = APIGeoService.departements.map { ["#{_1[:code]} – #{_1[:name]}", _1[:code]] }
|
||||
create_groups_from_territorial_tdc(tdc_options, stable_id)
|
||||
when TypeDeChamp.type_champs.fetch(:regions)
|
||||
|
|
|
@ -734,46 +734,6 @@ describe Administrateurs::GroupeInstructeursController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'with a communes type de champ' do
|
||||
let!(:procedure3) do
|
||||
create(:procedure,
|
||||
types_de_champ_public: [{ type: :communes }],
|
||||
administrateurs: [admin])
|
||||
end
|
||||
|
||||
let!(:communes_tdc) { procedure3.draft_revision.types_de_champ.first }
|
||||
|
||||
before { post :create_simple_routing, params: { procedure_id: procedure3.id, create_simple_routing: { stable_id: communes_tdc.stable_id } } }
|
||||
|
||||
it do
|
||||
expect(response).to redirect_to(admin_procedure_groupe_instructeurs_path(procedure3))
|
||||
expect(flash.notice).to eq 'Les groupes instructeurs ont été ajoutés'
|
||||
expect(procedure3.groupe_instructeurs.pluck(:label)).to include("01 – Ain")
|
||||
expect(procedure3.reload.defaut_groupe_instructeur.routing_rule).to eq(ds_eq(champ_value(communes_tdc.stable_id), constant('01')))
|
||||
expect(procedure3.routing_enabled).to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a epci type de champ' do
|
||||
let!(:procedure3) do
|
||||
create(:procedure,
|
||||
types_de_champ_public: [{ type: :epci }],
|
||||
administrateurs: [admin])
|
||||
end
|
||||
|
||||
let!(:epci_tdc) { procedure3.draft_revision.types_de_champ.first }
|
||||
|
||||
before { post :create_simple_routing, params: { procedure_id: procedure3.id, create_simple_routing: { stable_id: epci_tdc.stable_id } } }
|
||||
|
||||
it do
|
||||
expect(response).to redirect_to(admin_procedure_groupe_instructeurs_path(procedure3))
|
||||
expect(flash.notice).to eq 'Les groupes instructeurs ont été ajoutés'
|
||||
expect(procedure3.groupe_instructeurs.pluck(:label)).to include("01 – Ain")
|
||||
expect(procedure3.reload.defaut_groupe_instructeur.routing_rule).to eq(ds_eq(champ_value(epci_tdc.stable_id), constant('01')))
|
||||
expect(procedure3.routing_enabled).to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a departements type de champ' do
|
||||
let!(:procedure3) do
|
||||
create(:procedure,
|
||||
|
|
Loading…
Reference in a new issue