@@ -696,4 +696,46 @@ def get_echo_for(use_if)
696696 assert_equal "method-default" , get_echo_for ( :visible_4 ) # no match
697697 end
698698 end
699+
700+ describe "multiple argument validations with rescue_from" do
701+ let ( :schema ) do
702+ Class . new ( GraphQL ::Schema ) do
703+ rescue_from ( StandardError ) do |exception , _obj , _args , _context , _field |
704+ raise exception
705+ end
706+
707+ query_type = Class . new ( GraphQL ::Schema ::Object ) do
708+ graphql_name 'TestQueryType'
709+
710+ field :test , Integer , null : false do
711+ argument :a , Integer , validates : { numericality : { greater_than_or_equal_to : 1 } }
712+ argument :b , Integer , validates : { numericality : { greater_than_or_equal_to : 1 } }
713+ end
714+
715+ def test ; end
716+ end
717+
718+ query ( query_type )
719+ lazy_resolve ( Proc , :call )
720+ end
721+ end
722+
723+ it 'validates both arguments' do
724+ expected_errors = [
725+ {
726+ "message" => "a must be greater than or equal to 1" ,
727+ "locations" => [ { "line" => 1 , "column" => 3 } ] ,
728+ "path" => [ "test" ]
729+ } ,
730+ {
731+ "message" => "b must be greater than or equal to 1" ,
732+ "locations" => [ { "line" => 1 , "column" => 3 } ] ,
733+ "path" => [ "test" ]
734+ }
735+ ]
736+ query = "{ test(a: -4, b: -5) }"
737+
738+ assert_equal expected_errors , schema . execute ( query ) . to_h [ 'errors' ]
739+ end
740+ end
699741end
0 commit comments