spec/support/dummy/schema.rb in graphql-1.9.0.pre4 vs spec/support/dummy/schema.rb in graphql-1.9.0
- old
+ new
@@ -471,9 +471,21 @@
rescue_from(NoSuchDairyError) { |err| err.message }
def self.resolve_type(type, obj, ctx)
Schema.types[obj.class.name.split("::").last]
end
+
+ # This is used to confirm that the hook is called:
+ MAGIC_INT_COERCE_VALUE = -1
+
+ def self.type_error(err, ctx)
+ if err.is_a?(GraphQL::IntegerEncodingError) && err.integer_value == 99**99
+ MAGIC_INT_COERCE_VALUE
+ else
+ super
+ end
+ end
+
if TESTING_INTERPRETER
use GraphQL::Execution::Interpreter
end
end
end