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/resolver_type_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/resolver_type_spec.rb')
-rw-r--r-- | spec/rubocop/cop/graphql/resolver_type_spec.rb | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/spec/rubocop/cop/graphql/resolver_type_spec.rb b/spec/rubocop/cop/graphql/resolver_type_spec.rb index 25213e30528..11c0ad284a9 100644 --- a/spec/rubocop/cop/graphql/resolver_type_spec.rb +++ b/spec/rubocop/cop/graphql/resolver_type_spec.rb @@ -6,24 +6,19 @@ require 'rubocop' require_relative '../../../../rubocop/cop/graphql/resolver_type' RSpec.describe RuboCop::Cop::Graphql::ResolverType do - include CopHelper - subject(:cop) { described_class.new } - it 'adds an offense when there is no type annotaion' do - lacks_type = <<-SRC + it 'adds an offense when there is no type annotation' do + expect_offense(<<~SRC) module Resolvers class FooResolver < BaseResolver + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Missing type annotation: Please add `type` DSL method call. e.g: type UserType.connection_type, null: true def resolve(**args) [:thing] end end end SRC - - inspect_source(lacks_type) - - expect(cop.offenses.size).to eq 1 end it 'does not add an offense for resolvers that have a type call' do @@ -41,9 +36,10 @@ RSpec.describe RuboCop::Cop::Graphql::ResolverType do end it 'ignores type calls on other objects' do - lacks_type = <<-SRC + expect_offense(<<~SRC) module Resolvers class FooResolver < BaseResolver + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Missing type annotation: Please add `type` DSL method call. e.g: type UserType.connection_type, null: true class FalsePositive < BaseObject type RedHerringType, null: true end @@ -54,10 +50,6 @@ RSpec.describe RuboCop::Cop::Graphql::ResolverType do end end SRC - - inspect_source(lacks_type) - - expect(cop.offenses.size).to eq 1 end it 'does not add an offense unless the class is named using the Resolver convention' do |