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>2020-04-28 06:09:53 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-28 06:09:53 +0300
commit2e4d8b3449e8c2c750a816b9566c61a0a96b934b (patch)
tree831b4d55a3b283e519a4c911e444564d4c7c3344 /spec/rubocop
parent56df7f06f1e57d66efcff5d8ad0026252cc91192 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/rubocop')
-rw-r--r--spec/rubocop/cop/api/grape_api_instance_spec.rb31
-rw-r--r--spec/rubocop/cop/api/grape_array_missing_coerce_spec.rb64
-rw-r--r--spec/rubocop/cop/code_reuse/worker_spec.rb2
3 files changed, 1 insertions, 96 deletions
diff --git a/spec/rubocop/cop/api/grape_api_instance_spec.rb b/spec/rubocop/cop/api/grape_api_instance_spec.rb
deleted file mode 100644
index 0199377f104..00000000000
--- a/spec/rubocop/cop/api/grape_api_instance_spec.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-# frozen_string_literal: true
-
-require 'fast_spec_helper'
-require 'rubocop'
-require_relative '../../../support/helpers/expect_offense'
-require_relative '../../../../rubocop/cop/api/grape_api_instance'
-
-describe RuboCop::Cop::API::GrapeAPIInstance do
- include CopHelper
- include ExpectOffense
-
- subject(:cop) { described_class.new }
-
- it 'adds an offense when inheriting from Grape::API' do
- inspect_source(<<~CODE.strip_indent)
- class SomeAPI < Grape::API
- end
- CODE
-
- expect(cop.offenses.size).to eq(1)
- end
-
- it 'does not add an offense when inheriting from Grape::API::Instance' do
- inspect_source(<<~CODE.strip_indent)
- class SomeAPI < Grape::API::Instance
- end
- CODE
-
- expect(cop.offenses.size).to be_zero
- end
-end
diff --git a/spec/rubocop/cop/api/grape_array_missing_coerce_spec.rb b/spec/rubocop/cop/api/grape_array_missing_coerce_spec.rb
deleted file mode 100644
index 8252e07837d..00000000000
--- a/spec/rubocop/cop/api/grape_array_missing_coerce_spec.rb
+++ /dev/null
@@ -1,64 +0,0 @@
-# frozen_string_literal: true
-
-require 'fast_spec_helper'
-require 'rubocop'
-require_relative '../../../support/helpers/expect_offense'
-require_relative '../../../../rubocop/cop/api/grape_array_missing_coerce'
-
-describe RuboCop::Cop::API::GrapeArrayMissingCoerce do
- include CopHelper
- include ExpectOffense
-
- subject(:cop) { described_class.new }
-
- it 'adds an offense with a required parameter' do
- inspect_source(<<~CODE.strip_indent)
- class SomeAPI < Grape::API::Instance
- params do
- requires :values, type: Array[String]
- end
- end
- CODE
-
- expect(cop.offenses.size).to eq(1)
- end
-
- it 'adds an offense with an optional parameter' do
- inspect_source(<<~CODE.strip_indent)
- class SomeAPI < Grape::API::Instance
- params do
- optional :values, type: Array[String]
- end
- end
- CODE
-
- expect(cop.offenses.size).to eq(1)
- end
-
- it 'does not add an offense' do
- inspect_source(<<~CODE.strip_indent)
- class SomeAPI < Grape::API::Instance
- params do
- requires :values, type: Array[String], coerce_with: ->(val) { val.split(',').map(&:strip) }
- requires :milestone, type: String, desc: 'Milestone title'
- optional :assignee_id, types: [Integer, String], integer_none_any: true,
- desc: 'Return issues which are assigned to the user with the given ID'
- end
- end
- CODE
-
- expect(cop.offenses.size).to be_zero
- end
-
- it 'does not add an offense for unrelated classes' do
- inspect_source(<<~CODE.strip_indent)
- class SomeClass
- params do
- requires :values, type: Array[String]
- end
- end
- CODE
-
- expect(cop.offenses.size).to be_zero
- end
-end
diff --git a/spec/rubocop/cop/code_reuse/worker_spec.rb b/spec/rubocop/cop/code_reuse/worker_spec.rb
index 9005b5a0611..97acaeb7643 100644
--- a/spec/rubocop/cop/code_reuse/worker_spec.rb
+++ b/spec/rubocop/cop/code_reuse/worker_spec.rb
@@ -31,7 +31,7 @@ describe RuboCop::Cop::CodeReuse::Worker do
.and_return(true)
expect_offense(<<~SOURCE)
- class Foo < Grape::API::Instance
+ class Foo < Grape::API
resource :projects do
get '/' do
FooWorker.perform_async