File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,8 @@ def to_kwargs
118
118
ruby_kwargs
119
119
end
120
120
121
+ alias :to_hash :to_kwargs
122
+
121
123
private
122
124
123
125
class ArgumentValue
Original file line number Diff line number Diff line change 316
316
assert_equal :my_field , field . original_name
317
317
end
318
318
end
319
+
320
+ describe "generated default" do
321
+ class TestSchema < GraphQL ::Schema
322
+ class BaseField < GraphQL ::Schema ::Field
323
+ def resolve_field ( obj , args , ctx )
324
+ resolve ( obj , args , ctx )
325
+ end
326
+ end
327
+
328
+ class Company < GraphQL ::Schema ::Object
329
+ field :id , ID , null : false
330
+ end
331
+
332
+ class Query < GraphQL ::Schema ::Object
333
+ field_class BaseField
334
+
335
+ field :company , Company , null : true do
336
+ argument :id , ID , required : true
337
+ end
338
+
339
+ def company ( id :)
340
+ OpenStruct . new ( id : id )
341
+ end
342
+ end
343
+
344
+ query ( Query )
345
+ end
346
+
347
+ it "works" do
348
+ res = TestSchema . execute ( "{ company(id: \" 1\" ) { id } }" )
349
+ assert_equal "1" , res [ "data" ] [ "company" ] [ "id" ]
350
+ end
351
+ end
319
352
end
You can’t perform that action at this time.
0 commit comments