Writing tests for mutations - rmosolgo/graphql-ruby GitHub Wiki
Here's one possible pattern, this discussion:
# spec/graph/mutations/do_thing_spec.rb
query =
<<~GQL
mutation doThing(
$foo: String
$bar: String
...
GQL
result = Schema.execute query, variables: { 'foo' => foo, 'bar' => bar }
data = result.to_h['data']['doThing']['widget']
expect(data).to include(
'id' => 1,
'value' => bloop,
'stuff' => { 'name' => name,
'id' => 2}
)