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:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-11-30 21:07:14 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-11-30 21:07:14 +0300
commit9e7f94a7408534411dc8da69c9e3ad3a55722b51 (patch)
treebaf917b2ab176390258c3a6a282b3b2432d4469c /spec/rubocop/cop/graphql
parent826cf5293fb78029f76c5e769696e3b37e681207 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/rubocop/cop/graphql')
-rw-r--r--spec/rubocop/cop/graphql/descriptions_spec.rb75
1 files changed, 75 insertions, 0 deletions
diff --git a/spec/rubocop/cop/graphql/descriptions_spec.rb b/spec/rubocop/cop/graphql/descriptions_spec.rb
index 8826e700fdf..5e3f9539ff4 100644
--- a/spec/rubocop/cop/graphql/descriptions_spec.rb
+++ b/spec/rubocop/cop/graphql/descriptions_spec.rb
@@ -60,6 +60,33 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
TYPE
end
+ it 'adds an offense when description contains the demonstrative "this"' do
+ expect_offense(<<~TYPE)
+ module Types
+ class FakeType < BaseObject
+ field :a_thing,
+ ^^^^^^^^^^^^^^^ #{described_class::MSG_CONTAINS_THIS}
+ GraphQL::Types::String,
+ null: false,
+ description: 'Description of this thing.'
+ end
+ end
+ TYPE
+ end
+
+ it 'does not add an offense when a word contains the substring "this"' do
+ expect_no_offenses(<<~TYPE)
+ module Types
+ class FakeType < BaseObject
+ field :a_thing,
+ GraphQL::Types::String,
+ null: false,
+ description: 'Description of thistle.'
+ end
+ end
+ TYPE
+ end
+
it 'does not add an offense when description is correct' do
expect_no_offenses(<<~TYPE.strip)
module Types
@@ -140,6 +167,33 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
TYPE
end
+ it 'adds an offense when description contains the demonstrative "this"' do
+ expect_offense(<<~TYPE)
+ module Types
+ class FakeType < BaseObject
+ argument :a_thing,
+ ^^^^^^^^^^^^^^^^^^ #{described_class::MSG_CONTAINS_THIS}
+ GraphQL::Types::String,
+ null: false,
+ description: 'Description of this thing.'
+ end
+ end
+ TYPE
+ end
+
+ it 'does not add an offense when a word contains the substring "this"' do
+ expect_no_offenses(<<~TYPE)
+ module Types
+ class FakeType < BaseObject
+ argument :a_thing,
+ GraphQL::Types::String,
+ null: false,
+ description: 'Description of thistle.'
+ end
+ end
+ TYPE
+ end
+
it 'does not add an offense when description is correct' do
expect_no_offenses(<<~TYPE.strip)
module Types
@@ -199,6 +253,27 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
TYPE
end
+ it 'adds an offense when description contains the demonstrative "this"' do
+ expect_offense(<<~TYPE.strip)
+ module Types
+ class FakeEnum < BaseEnum
+ value 'FOO', value: 'foo', description: 'Description of this issue.'
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ #{described_class::MSG_CONTAINS_THIS}
+ end
+ end
+ TYPE
+ end
+
+ it 'does not add an offense when a word contains the substring "this"' do
+ expect_no_offenses(<<~TYPE.strip)
+ module Types
+ class FakeEnum < BaseEnum
+ value 'FOO', value: 'foo', description: 'Description of thistle.'
+ end
+ end
+ TYPE
+ end
+
it 'does not add an offense when description is correct (defined using `description:`)' do
expect_no_offenses(<<~TYPE.strip)
module Types