From f8f89cd6c60d9af8165e70c463f7e9b1ed5f6965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Brand=C3=A3o?= Date: Thu, 7 May 2020 15:37:34 -0300 Subject: [PATCH] Version 1.3.0 --- CHANGELOG.md | 9 +++------ README.md | 12 ++++++++++++ lib/rspec/graphql_matchers/version.rb | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c72ff0..57f5e96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,9 @@ # Changelog -### Breaking changes - -### Deprecations +## 1.3.0 (May 7th, 2020) -### New features - -### Bug fixes +- `accept_argument` matcher accepts underscored argument names and passes even if the actual argument is camel-cased (https://github.com/khamusa/rspec-graphql_matchers/pull/32 thanks to @TonyArra); +- `have_a_field` matcher accepts `.with_deprecation_reason` (https://github.com/khamusa/rspec-graphql_matchers/pull/34 thanks to @TonyArra). ## 1.2.1 (March 31st, 2020) diff --git a/README.md b/README.md index 81a3d5c..035b4a3 100644 --- a/README.md +++ b/README.md @@ -46,10 +46,12 @@ class PostType < GraphQL::Schema::Object field :id, ID, null: false field :comments, [String], null: false field :isPublished, Boolean, null: true + field :published, Boolean, null: false, deprecation_reason: 'Use isPublished instead' field :subposts, PostType, null: true do argument :filter, types.String, required: false argument :id, types.ID, required: false + argument :isPublished, types.Boolean, required: false end end ``` @@ -64,6 +66,12 @@ describe PostType do it { is_expected.to have_field(:comments).of_type("[String!]!") } it { is_expected.to have_field(:isPublished).of_type("Boolean") } + # Check a field is deprecated + it { is_expected.to have_field(:published).with_deprecation_reason } + it { is_expected.to have_field(:published).with_deprecation_reason('Use isPublished instead') } + it { is_expected.not_to have_field(:published).with_deprecation_reason('Wrong reason') } + it { is_expected.not_to have_field(:isPublished).with_deprecation_reason } + # The gem automatically converts field names to CamelCase, so this will # pass even though the field was defined as field :isPublished it { is_expected.to have_field(:is_published).of_type("Boolean") } @@ -122,6 +130,10 @@ describe PostType do end it { is_expected.not_to accept_argument(:weirdo) } + + # The gem automatically converts argument names to CamelCase, so this will + # pass even though the argument was defined as :isPublished + it { is_expected.to accept_argument(:is_published).of_type("Boolean") } end end ``` diff --git a/lib/rspec/graphql_matchers/version.rb b/lib/rspec/graphql_matchers/version.rb index 7a60398..96ed0bc 100644 --- a/lib/rspec/graphql_matchers/version.rb +++ b/lib/rspec/graphql_matchers/version.rb @@ -2,6 +2,6 @@ module Rspec module GraphqlMatchers - VERSION = '1.2.1' + VERSION = '1.3.0' end end