feat(routing): can create simple routing with address tdc
This commit is contained in:
parent
8b4b4d7cb7
commit
fade633828
3 changed files with 23 additions and 2 deletions
|
@ -53,7 +53,7 @@ module Administrateurs
|
|||
tdc_options = APIGeoService.departements.map { ["#{_1[:code]} – #{_1[:name]}", _1[:code]] }
|
||||
rule_operator = :ds_eq
|
||||
create_groups_from_territorial_tdc(tdc_options, stable_id, rule_operator)
|
||||
when TypeDeChamp.type_champs.fetch(:communes), TypeDeChamp.type_champs.fetch(:epci)
|
||||
when TypeDeChamp.type_champs.fetch(:communes), TypeDeChamp.type_champs.fetch(:epci), TypeDeChamp.type_champs.fetch(:address)
|
||||
tdc_options = APIGeoService.departements.map { ["#{_1[:code]} – #{_1[:name]}", _1[:code]] }
|
||||
rule_operator = :ds_in_departement
|
||||
create_groups_from_territorial_tdc(tdc_options, stable_id, rule_operator)
|
||||
|
|
|
@ -117,7 +117,8 @@ class TypeDeChamp < ApplicationRecord
|
|||
type_champs.fetch(:communes),
|
||||
type_champs.fetch(:departements),
|
||||
type_champs.fetch(:regions),
|
||||
type_champs.fetch(:epci)
|
||||
type_champs.fetch(:epci),
|
||||
type_champs.fetch(:address)
|
||||
]
|
||||
|
||||
PRIVATE_ONLY_TYPES = [
|
||||
|
|
|
@ -933,6 +933,26 @@ describe Administrateurs::GroupeInstructeursController, type: :controller do
|
|||
expect(procedure3.routing_enabled).to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
context 'with an address type de champ' do
|
||||
let!(:procedure3) do
|
||||
create(:procedure,
|
||||
types_de_champ_public: [{ type: :address }],
|
||||
administrateurs: [admin])
|
||||
end
|
||||
|
||||
let!(:address_tdc) { procedure3.draft_revision.types_de_champ.first }
|
||||
|
||||
before { post :create_simple_routing, params: { procedure_id: procedure3.id, create_simple_routing: { stable_id: address_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_in_departement(champ_value(address_tdc.stable_id), constant('01')))
|
||||
expect(procedure3.routing_enabled).to be_truthy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#wizard' do
|
||||
|
|
Loading…
Reference in a new issue