From 5ea938f31b11aa64d24b61e52c74e0952892a7f2 Mon Sep 17 00:00:00 2001 From: Wade Tandy Date: Wed, 27 Mar 2019 17:37:24 -0400 Subject: [PATCH] add string_enum filter test --- spec/filtering_spec.rb | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/spec/filtering_spec.rb b/spec/filtering_spec.rb index 39016067..23094415 100644 --- a/spec/filtering_spec.rb +++ b/spec/filtering_spec.rb @@ -395,15 +395,30 @@ def self.name end context "when allow list is omitted" do - it "raises an error at load time" do - expect { - resource.filter :enum_age, :integer_enum do - eq do |scope, value| - scope[:conditions][:age] = value - scope + context 'when using a string_enum field' do + it "raises an error at load time" do + expect { + resource.filter :enum_first_name, :string_enum do + eq do |scope, value| + scope[:conditions][:first_name] = value + scope + end end - end - }.to raise_error(Graphiti::Errors::MissingEnumAllowList, /integer_enum/) + }.to raise_error(Graphiti::Errors::MissingEnumAllowList, /string_enum/) + end + end + + context 'when using an integer_enum field' do + it "raises an error at load time" do + expect { + resource.filter :enum_age, :integer_enum do + eq do |scope, value| + scope[:conditions][:age] = value + scope + end + end + }.to raise_error(Graphiti::Errors::MissingEnumAllowList, /integer_enum/) + end end end end