spec/support/dummy/schema.rb in graphql-1.7.6 vs spec/support/dummy/schema.rb in graphql-1.7.7
- old
+ new
@@ -147,10 +147,19 @@
name "MaybeNull"
description "An object whose fields return nil"
field :cheese, CheeseType
end
+ TracingScalarType = GraphQL::ObjectType.define do
+ name "TracingScalar"
+ description "An object which has traced scalars"
+
+ field :traceNil, types.Int
+ field :traceFalse, types.Int, trace: false
+ field :traceTrue, types.Int, trace: true
+ end
+
DairyProductUnion = GraphQL::UnionType.define do
name "DairyProduct"
description "Kinds of food made from milk"
# Test that these forms of declaration still work:
possible_types ["Dummy::MilkType", -> { CheeseType }]
@@ -368,9 +377,19 @@
end
# To test possibly-null fields
field :maybeNull, MaybeNullType do
resolve ->(t, a, c) { OpenStruct.new(cheese: nil) }
+ end
+
+ field :tracingScalar, TracingScalarType do
+ resolve ->(o, a, c) do
+ OpenStruct.new(
+ traceNil: 2,
+ traceFalse: 3,
+ tracetrue: 5,
+ )
+ end
end
field :deepNonNull, !DeepNonNullType do
resolve ->(o, a, c) { :deepNonNull }
end