From ee4dd93c335eaa81376aac8a09d308614620cf27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivar=20Conradi=20=C3=98sthus?= Date: Tue, 21 Jun 2022 19:52:45 +0200 Subject: [PATCH] fix: add test case for missing context field --- spec/unleash/constraint_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spec/unleash/constraint_spec.rb b/spec/unleash/constraint_spec.rb index bcd61471..b710aa03 100644 --- a/spec/unleash/constraint_spec.rb +++ b/spec/unleash/constraint_spec.rb @@ -405,5 +405,12 @@ end.to raise_error end end + + it 'handles missing custom field context' do + context_params = {} + context = Unleash::Context.new(context_params) + constraint = Unleash::Constraint.new('customField', 'STR_STARTS_WITH', ['customField']) + expect(constraint.matches_context?(context)).to be false + end end end