Uninitialized constant GraphQL::Testing
petrenkorf opened this issue · 1 comments
Describe the bug
I'm trying to write an unit test for a method defined inside a Type class, and according to this docs I should include the test helpers as the following:
include GraphQL::Testing::Helpers.for(MySchema)
However I'm just receiving an error message claiming that GraphQL::Testing is an uninitialized constant. Is there any other simple way to test a method declared in a Type?
Versions
graphql
version: 2.0.27
rails
: 7.0.8
Steps to reproduce
- Create a new type, and define any method inside it;
- Create a RSpec test file for the created in the previous step
- Include the helper into the spec (
include GraphQL::Testing::Helpers.for(YourSchema)
) - Run the spec.
Expected behavior
I should be able to call run_graphql_field
in the specs
Actual behavior
Running the spec file raises the following error
uninitialized constant GraphQL::Testing
Hi! thanks for the detailed writeup. run_graphql_field
was added in v2.2.0, but I see your GraphQL version is 2.0.27. Please update the gem to at least 2.2.0 and try again. If it doesn't work, please let me know here and I'll reopen this so we can investigate further 👍