I have a GraphQL::Schema::InputObject
subclass that I pass around inside my Rails server's GraphQL mutation handler. I've separated out some of the parts of the code as separate units to test and would like to create an instance of this object in test. How can I do this?
My subclass looks like this:
class Foo < GraphQL::Schema::InputObject
argument :bar, Int, required: true
end
I peeked inside the graphql-ruby tests and saw there's a constructor that take a Hash, so I tried:
Foo.new({bar: 42}, context: OpenStruct.new(), defaults_used: Set.new())
but I get back:
NoMethodError (undefined method `new' for nil:NilClass)
I'm using graphql-ruby 1.9.9.
Aucun commentaire:
Enregistrer un commentaire