Comments (4)
Hey @khamusa,
Thanks for your answer, I get it now.
I proposed a PR to remove the line where you suggest to add it to the spec_helper.rb
so newcomers don't get confused
Thanks for your work,
Cheers
from rspec-graphql_matchers.
Hi,
How do you use the gem without this? I tried including it but keep having NameError: uninitialized constant RSpec::GraphqlMatchers
from rspec-graphql_matchers.
Hi @StanBoyet ,
I haven't really worked on this Issue for many reasons. Mainly I'm thinking it's not a good idea as a feature, as the Graphql-ruby creator himself has been proposing to avoid the usage of types
and instead using the type constants directly.
there are quite a few ways to work around this. The first one, if you want to use the types variable, is to define it yourself.
types
is basically a shortcut to GraphQL::Define::TypeDefiner.instance
, so you can define a method called types
or assign GraphQL::Define::TypeDefiner.instance
to a variable called types, depending on your context / test runner.
However, after writing quite a lot of specs on types, I believe the main purpose of these is to help you to avoid breaking changes on your api interface. For that purpose, a better idea is to specify types directly as strings instead of using the constants. Suppose you have a type User
, and you write your specs using a ruby constant UserType
. At some point you decide to rename the User
type to Player
, but you keep the same constant throught your application. If you wrote your specs using the constant UserType
, they will still pass, but this is a potentially breaking change as clients may have defined queries using variables of type User
, which is now Player
.
Hope this helps :)
Edit: using strings you have the additional benefit of depending less on the inners of the graphql-ruby
implementation.
from rspec-graphql_matchers.
I really thought I had already removed that line! Thank you ;)
I'll close this issue now.
from rspec-graphql_matchers.
Related Issues (19)
- add has_metadata matcher on object type HOT 1
- add support for `with_deprecation_reason` HOT 2
- Type specs fail after graphql-ruby changed behavior of Type classes HOT 3
- Specs fail with "types" syntax HOT 1
- Cannot use with new version of graphql gem HOT 1
- Problem with `.have_field` and `.of_type` HOT 3
- expected Types::ClassName to respond to `has_a_field?` HOT 2
- Supporting version 1.9 ? HOT 1
- Convert :field_name to 'fieldName' automaticallly HOT 1
- Test resolution with property HOT 2
- Version 1.2 missing support for snake_case field names HOT 2
- Proposition: add a matcher chain for :method on field definition HOT 1
- undefined method `failure_message_when_negated'
- Using this with graphql-ruby / rails HOT 3
- Test GraphQL::Schema::Enum HOT 1
- .Legacy `.to_graphql` objects are deprecated and will be removed in GraphQL-Ruby 2.0. HOT 1
- Support graphql 2.0 HOT 5
- add a description matcher on the field HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rspec-graphql_matchers.