feat(conditional): can condition and route with pays tdc

This commit is contained in:
Eric Leroy-Terquem 2024-11-04 10:54:00 +01:00
parent b02f95336f
commit b29893a843
No known key found for this signature in database
GPG key ID: 53D8FAECEF207605
3 changed files with 41 additions and 3 deletions

View file

@ -181,6 +181,29 @@ describe RoutingEngine, type: :model do
end
end
context 'with a pays type de champ' do
let(:procedure) do
create(:procedure, types_de_champ_public: [{ type: :pays }]).tap do |p|
p.groupe_instructeurs.create(label: 'a third group')
end
end
let(:pays_tdc) { procedure.draft_revision.types_de_champ.first }
context 'with a matching rule' do
before do
gi_2.update(routing_rule: ds_eq(champ_value(pays_tdc.stable_id), constant('BE')))
dossier.champs.first.update_columns(
value: "Belgique"
)
end
it do
is_expected.to eq(gi_2)
end
end
end
context 'routing rules priorities' do
let(:procedure) do
create(:procedure,