test(routing): test routing controller with not_eq operator
This commit is contained in:
parent
a7859a8a9c
commit
6f7aaef132
1 changed files with 59 additions and 18 deletions
|
@ -11,12 +11,15 @@ describe Administrateurs::RoutingController, type: :controller do
|
||||||
{
|
{
|
||||||
procedure_id: procedure.id,
|
procedure_id: procedure.id,
|
||||||
targeted_champ: champ_value(drop_down_tdc.stable_id).to_json,
|
targeted_champ: champ_value(drop_down_tdc.stable_id).to_json,
|
||||||
operator_name: Logic::Eq.name,
|
operator_name: operator_name,
|
||||||
value: empty.to_json,
|
value: empty.to_json,
|
||||||
groupe_instructeur_id: gi_2.id
|
groupe_instructeur_id: gi_2.id
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'with Eq operator' do
|
||||||
|
let(:operator_name) { Logic::Eq.name }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
post :update, params: params, format: :turbo_stream
|
post :update, params: params, format: :turbo_stream
|
||||||
end
|
end
|
||||||
|
@ -51,6 +54,44 @@ describe Administrateurs::RoutingController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'with NotEq operator' do
|
||||||
|
let(:operator_name) { Logic::NotEq.name }
|
||||||
|
|
||||||
|
before do
|
||||||
|
post :update, params: params, format: :turbo_stream
|
||||||
|
end
|
||||||
|
|
||||||
|
it do
|
||||||
|
expect(gi_2.reload.routing_rule).to eq(ds_not_eq(champ_value(drop_down_tdc.stable_id), empty))
|
||||||
|
end
|
||||||
|
|
||||||
|
context '#update value' do
|
||||||
|
let(:value_updated_params) { params.merge(value: constant('Lyon').to_json) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
post :update, params: value_updated_params, format: :turbo_stream
|
||||||
|
end
|
||||||
|
|
||||||
|
it do
|
||||||
|
expect(gi_2.reload.routing_rule).to eq(ds_not_eq(champ_value(drop_down_tdc.stable_id), constant('Lyon')))
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'targeted champ changed' do
|
||||||
|
let(:last_tdc) { procedure.draft_revision.types_de_champ.last }
|
||||||
|
|
||||||
|
before do
|
||||||
|
targeted_champ_updated_params = value_updated_params.merge(targeted_champ: champ_value(last_tdc.stable_id).to_json)
|
||||||
|
post :update, params: targeted_champ_updated_params, format: :turbo_stream
|
||||||
|
end
|
||||||
|
|
||||||
|
it do
|
||||||
|
expect(gi_2.reload.routing_rule).to eq(ds_not_eq(champ_value(last_tdc.stable_id), empty))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "#update_defaut_groupe_instructeur" do
|
describe "#update_defaut_groupe_instructeur" do
|
||||||
let(:procedure) { create(:procedure) }
|
let(:procedure) { create(:procedure) }
|
||||||
let(:gi_2) { create(:groupe_instructeur, label: 'groupe 2', procedure: procedure) }
|
let(:gi_2) { create(:groupe_instructeur, label: 'groupe 2', procedure: procedure) }
|
||||||
|
|
Loading…
Add table
Reference in a new issue