- Adds compatibility with graphql-ruby 2.0+. If you're still using an earlier version, you should stick to 1.4.x.
-
The usage of the
#types
helper when writing tests (if you're not includingRSpec::GraphqlMatchers::TypesHelper
anywhere, you shoudn't have to change anything). UseGraphQL::Types::<TYPE_NAME>
instead -
The usage of type instances as expected value for a type comparison is deprecated. Instead, use the string that represents the type specification. Examples:
# Bad - These are deprecated: expect(a_type).to have_a_field(:lorem).of_type(GraphQL::Types::ID) expect(a_type).to have_a_field(:lorem).of_type(Types::MyCustomType) # Good - Use these instead expect(a_type).to have_a_field(:lorem).of_type('ID') expect(a_type).to have_a_field(:lorem).of_type('MyCustomType')
The reason behind this change relies on the fact that we should have a decoupling between the internal constants used to define our API and the public names exposed through it. If we test a published API using the internal constants, it is possible to perform breaking changes by renaming the graphql names of our types or entities without actually breaking the tests.
If we're performing a breaking change to a public API, we want our tests to fail.
- Removal of deprecated calls to #to_graphql, replacing them with #to_type_signature that was added in graphql-ruby 1.8.3 (#43 @RobinDaugherty)
- Dropped support for legacy .define API
- Dropped support to old relay interfaces
- Fixed with_hash_key matcher for newer versions of graphql-ruby
- Fixed errors that occured in some edge cases when generating descriptions for accept_argument and have_a_field matchers
- Documentations improvement and general cleanup
- Dropped support to graphql-ruby versions before 1.10.12.
- Corrected gem dependencies so it properly requires RSpec when loaded (thanks to @itay-grudev)
accept_argument
matcher accepts underscored argument names and passes even if the actual argument is camel-cased (#32 thanks to @TonyArra);have_a_field
matcher accepts.with_deprecation_reason
(#34 thanks to @TonyArra).
- Fixed issue causing the last release to break expectations against snake_cased fields (fixes #30).
- Added support to underscored arguments in have_field (#29 thanks to @makketagg)
- Added graphql-ruby 1.9.x support (thanks to @severin)
- Fixed issue causing
have_a_field(x).of_type(Y)
to fail on fields defined on implemented interfaces that were defined with legacy syntax.
- Support to property and hash_key matchers will be dropped on upcoming releases.
.with_metadata
and.with_property
matchers for fields will be removed on the next release;.accept_arguments
(plural form) will be removed on the next release;.accept_argument
(singular form) receiving a hash with a single or multiple arguments will no longer be supported, useaccept_argument(name).of_type('MyType')
instead.
- Add support for Class-based type definition api (adds support for graphql-ruby v1.8.x). Please note that
.with_metadata
and.with_property
support has been kept but will only work on fields defined using the legacy api. - Implemented `accept_argument(arg_name).of_type('MyType')´ matcher, which returns much clearer error messages when the arguments are not found on the target type.
Changelog fixes.
- (#3, #8) New chainable matchers
with_property
,with_hash_key
andwith_metadata
(Thanks to @marcgreenstock).
- Default Raketask runs rubocop specs as well (Thanks to @marcgreenstock).
- (PR #6) New matchers for interfaces:
expect(...).to implement(interface)
(Thanks to @marcgreenstock).
- (PR #4) New matchers for mutations:
have_an_input_field
andhave_a_return_field
(Thanks to @aaronklaassen).
- Improvements on error messages of have_a_field(...).of_type(...)
- Fixed a bug preventing proper type checking when using matchers in the form have_a_field(fname).of_type(types.X). The bug would not happen when providing the type expectation as a string, only when using the GraphQL constants.
- New matcher have_field(field_name).of_type(type) for testing types and their fields
- New matcher be_of_type for testing fields
- New matcher accept_arguments for testing fields