You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to invoke resolve on something but I can't figure out how to get to it in UserMutations::CompleteCheckout. There's a @resolve_proc instance variable but I would have to use metaprogramming to access it.
Let me know any ideas and I'll try to contribute to the docs with what I come up with!
The text was updated successfully, but these errors were encountered:
without going through the HTTP or controller layer?
You can call MySchema.execute(...) directly, with a GraphQL query string, but that's the only other option that I know of.
I recommend writing an "integration test" like that ☝️ , but then extracting all the mutation's logic into plain ol' Ruby code, and unit testing that separately.
For example, if you have a complicated AddUserToTeam mutation, add
# app/models/user/add_to_team.rbclassUser::AddToTeamdefinitialize(graphql_inputs)# ...enddefperform# ... do the stuff endend
Then test that class on its own. (Call it a "Service object" if you like :P)
Is there a pattern for testing mutations directly, without going through the HTTP or controller layer? This blog post proposes one:
https://www.codementor.io/karanjaeddy/build-a-to-do-list-api-with-graphql-api-rails-5-part-1-irjt1e7jm#mutations
But I haven't been able to get it to work in my app for an endpoint of this form
I want to invoke
resolve
on something but I can't figure out how to get to it inUserMutations::CompleteCheckout
. There's a@resolve_proc
instance variable but I would have to use metaprogramming to access it.Let me know any ideas and I'll try to contribute to the docs with what I come up with!
The text was updated successfully, but these errors were encountered: