Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/rubocop/cop/graphql/resolver_type_spec.rb')
-rw-r--r--spec/rubocop/cop/graphql/resolver_type_spec.rb18
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