Skip to content

Commit

Permalink
add string_enum filter test
Browse files Browse the repository at this point in the history
  • Loading branch information
wadetandy committed Mar 27, 2019
1 parent a6db8a8 commit 5ea938f
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions spec/filtering_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5ea938f

Please # to comment.