diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /spec/rubocop/cop/graphql/descriptions_spec.rb | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'spec/rubocop/cop/graphql/descriptions_spec.rb')
-rw-r--r-- | spec/rubocop/cop/graphql/descriptions_spec.rb | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/spec/rubocop/cop/graphql/descriptions_spec.rb b/spec/rubocop/cop/graphql/descriptions_spec.rb index b44205b0920..9ad40fad83d 100644 --- a/spec/rubocop/cop/graphql/descriptions_spec.rb +++ b/spec/rubocop/cop/graphql/descriptions_spec.rb @@ -5,38 +5,34 @@ require 'rubocop' require_relative '../../../../rubocop/cop/graphql/descriptions' RSpec.describe RuboCop::Cop::Graphql::Descriptions do - include CopHelper - subject(:cop) { described_class.new } context 'fields' do it 'adds an offense when there is no description' do - inspect_source(<<~TYPE) + expect_offense(<<~TYPE) module Types class FakeType < BaseObject field :a_thing, + ^^^^^^^^^^^^^^^ Please add a `description` property. GraphQL::STRING_TYPE, null: false end end TYPE - - expect(cop.offenses.size).to eq 1 end it 'adds an offense when description does not end in a period' do - inspect_source(<<~TYPE) + expect_offense(<<~TYPE) module Types class FakeType < BaseObject field :a_thing, + ^^^^^^^^^^^^^^^ `description` strings must end with a `.`. GraphQL::STRING_TYPE, null: false, description: 'A descriptive description' end end TYPE - - expect(cop.offenses.size).to eq 1 end it 'does not add an offense when description is correct' do @@ -55,32 +51,30 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do context 'arguments' do it 'adds an offense when there is no description' do - inspect_source(<<~TYPE) + expect_offense(<<~TYPE) module Types class FakeType < BaseObject argument :a_thing, + ^^^^^^^^^^^^^^^^^^ Please add a `description` property. GraphQL::STRING_TYPE, null: false end end TYPE - - expect(cop.offenses.size).to eq 1 end it 'adds an offense when description does not end in a period' do - inspect_source(<<~TYPE) + expect_offense(<<~TYPE) module Types class FakeType < BaseObject argument :a_thing, + ^^^^^^^^^^^^^^^^^^ `description` strings must end with a `.`. GraphQL::STRING_TYPE, null: false, description: 'Behold! A description' end end TYPE - - expect(cop.offenses.size).to eq 1 end it 'does not add an offense when description is correct' do |