From a54d55486c8e6210a82caf5df7fc90e417f072c6 Mon Sep 17 00:00:00 2001 From: Eric Leroy-Terquem Date: Wed, 22 Nov 2023 12:04:25 +0100 Subject: [PATCH] chore(routing): update routing_rule validation --- app/models/groupe_instructeur.rb | 2 +- spec/models/routing_engine_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/groupe_instructeur.rb b/app/models/groupe_instructeur.rb index f7ecf059d..524d9e9c8 100644 --- a/app/models/groupe_instructeur.rb +++ b/app/models/groupe_instructeur.rb @@ -92,7 +92,7 @@ class GroupeInstructeur < ApplicationRecord end def valid_rule_line?(rule) - ([rule.left, rule, rule.right] in [ChampValue, (LessThan | LessThanEq | Eq | NotEq | GreaterThanEq | GreaterThan | IncludeOperator | ExcludeOperator), Constant]) && routing_rule_matches_tdc?(rule) + !rule.is_a?(EmptyOperator) && routing_rule_matches_tdc?(rule) end def non_unique_rule? diff --git a/spec/models/routing_engine_spec.rb b/spec/models/routing_engine_spec.rb index 36ea5bc63..4692638d7 100644 --- a/spec/models/routing_engine_spec.rb +++ b/spec/models/routing_engine_spec.rb @@ -28,7 +28,7 @@ describe RoutingEngine, type: :model do context 'without any matching rules' do before do procedure.groupe_instructeurs.each do |gi| - gi.update(routing_rule: ds_eq(constant(false), constant(false))) + gi.update(routing_rule: ds_eq(constant(false), constant(true))) end end