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-06-18 14:18:50 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 14:18:50 +0300
commit8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch)
treea77e7fe7a93de11213032ed4ab1f33a3db51b738 /spec/rubocop/cop/gitlab
parent00b35af3db1abfe813a778f643dad221aad51fca (diff)
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'spec/rubocop/cop/gitlab')
-rw-r--r--spec/rubocop/cop/gitlab/bulk_insert_spec.rb19
-rw-r--r--spec/rubocop/cop/gitlab/change_timezone_spec.rb2
-rw-r--r--spec/rubocop/cop/gitlab/const_get_inherit_false_spec.rb12
-rw-r--r--spec/rubocop/cop/gitlab/duplicate_spec_location_spec.rb14
4 files changed, 33 insertions, 14 deletions
diff --git a/spec/rubocop/cop/gitlab/bulk_insert_spec.rb b/spec/rubocop/cop/gitlab/bulk_insert_spec.rb
new file mode 100644
index 00000000000..937c709218f
--- /dev/null
+++ b/spec/rubocop/cop/gitlab/bulk_insert_spec.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+require 'rubocop'
+require 'rubocop/rspec/support'
+require_relative '../../../../rubocop/cop/gitlab/bulk_insert'
+
+describe RuboCop::Cop::Gitlab::BulkInsert do
+ include CopHelper
+
+ subject(:cop) { described_class.new }
+
+ it 'flags the use of Gitlab::Database.bulk_insert' do
+ expect_offense(<<~SOURCE)
+ Gitlab::Database.bulk_insert('merge_request_diff_files', rows)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use the `BulkInsertSafe` concern, instead of using `Gitlab::Database.bulk_insert`. See https://docs.gitlab.com/ee/development/insert_into_tables_in_batches.html
+ SOURCE
+ end
+end
diff --git a/spec/rubocop/cop/gitlab/change_timezone_spec.rb b/spec/rubocop/cop/gitlab/change_timezone_spec.rb
index af76559a9fa..1e4b4048cf4 100644
--- a/spec/rubocop/cop/gitlab/change_timezone_spec.rb
+++ b/spec/rubocop/cop/gitlab/change_timezone_spec.rb
@@ -12,7 +12,7 @@ describe RuboCop::Cop::Gitlab::ChangeTimezone do
context 'Time.zone=' do
it 'registers an offense with no 2nd argument' do
- expect_offense(<<~PATTERN.strip_indent)
+ expect_offense(<<~PATTERN)
Time.zone = 'Awkland'
^^^^^^^^^^^^^^^^^^^^^ Do not change timezone in the runtime (application or rspec), it could result in silently modifying other behavior.
PATTERN
diff --git a/spec/rubocop/cop/gitlab/const_get_inherit_false_spec.rb b/spec/rubocop/cop/gitlab/const_get_inherit_false_spec.rb
index 0ff06b431eb..bf0434e7afe 100644
--- a/spec/rubocop/cop/gitlab/const_get_inherit_false_spec.rb
+++ b/spec/rubocop/cop/gitlab/const_get_inherit_false_spec.rb
@@ -12,7 +12,7 @@ describe RuboCop::Cop::Gitlab::ConstGetInheritFalse do
context 'Object.const_get' do
it 'registers an offense with no 2nd argument' do
- expect_offense(<<~PATTERN.strip_indent)
+ expect_offense(<<~PATTERN)
Object.const_get(:CONSTANT)
^^^^^^^^^ Use inherit=false when using const_get.
PATTERN
@@ -24,7 +24,7 @@ describe RuboCop::Cop::Gitlab::ConstGetInheritFalse do
context 'inherit=false' do
it 'does not register an offense' do
- expect_no_offenses(<<~PATTERN.strip_indent)
+ expect_no_offenses(<<~PATTERN)
Object.const_get(:CONSTANT, false)
PATTERN
end
@@ -32,7 +32,7 @@ describe RuboCop::Cop::Gitlab::ConstGetInheritFalse do
context 'inherit=true' do
it 'registers an offense' do
- expect_offense(<<~PATTERN.strip_indent)
+ expect_offense(<<~PATTERN)
Object.const_get(:CONSTANT, true)
^^^^^^^^^ Use inherit=false when using const_get.
PATTERN
@@ -46,7 +46,7 @@ describe RuboCop::Cop::Gitlab::ConstGetInheritFalse do
context 'const_get for a nested class' do
it 'registers an offense on reload usage' do
- expect_offense(<<~PATTERN.strip_indent)
+ expect_offense(<<~PATTERN)
Nested::Blog.const_get(:CONSTANT)
^^^^^^^^^ Use inherit=false when using const_get.
PATTERN
@@ -58,7 +58,7 @@ describe RuboCop::Cop::Gitlab::ConstGetInheritFalse do
context 'inherit=false' do
it 'does not register an offense' do
- expect_no_offenses(<<~PATTERN.strip_indent)
+ expect_no_offenses(<<~PATTERN)
Nested::Blog.const_get(:CONSTANT, false)
PATTERN
end
@@ -66,7 +66,7 @@ describe RuboCop::Cop::Gitlab::ConstGetInheritFalse do
context 'inherit=true' do
it 'registers an offense if inherit is true' do
- expect_offense(<<~PATTERN.strip_indent)
+ expect_offense(<<~PATTERN)
Nested::Blog.const_get(:CONSTANT, true)
^^^^^^^^^ Use inherit=false when using const_get.
PATTERN
diff --git a/spec/rubocop/cop/gitlab/duplicate_spec_location_spec.rb b/spec/rubocop/cop/gitlab/duplicate_spec_location_spec.rb
index 87dd2f14b31..3a0a74a4713 100644
--- a/spec/rubocop/cop/gitlab/duplicate_spec_location_spec.rb
+++ b/spec/rubocop/cop/gitlab/duplicate_spec_location_spec.rb
@@ -20,7 +20,7 @@ describe RuboCop::Cop::Gitlab::DuplicateSpecLocation do
context 'Non-EE spec file' do
it 'registers no offenses' do
- expect_no_offenses(<<~SOURCE.strip_indent, full_path('spec/foo_spec.rb'))
+ expect_no_offenses(<<~SOURCE, full_path('spec/foo_spec.rb'))
describe 'Foo' do
end
SOURCE
@@ -29,7 +29,7 @@ describe RuboCop::Cop::Gitlab::DuplicateSpecLocation do
context 'Non-EE application file' do
it 'registers no offenses' do
- expect_no_offenses(<<~SOURCE.strip_indent, full_path('app/models/blog_post.rb'))
+ expect_no_offenses(<<~SOURCE, full_path('app/models/blog_post.rb'))
class BlogPost
end
SOURCE
@@ -38,7 +38,7 @@ describe RuboCop::Cop::Gitlab::DuplicateSpecLocation do
context 'EE application file' do
it 'registers no offenses' do
- expect_no_offenses(<<~SOURCE.strip_indent, full_path('ee/app/models/blog_post.rb'))
+ expect_no_offenses(<<~SOURCE, full_path('ee/app/models/blog_post.rb'))
class BlogPost
end
SOURCE
@@ -49,7 +49,7 @@ describe RuboCop::Cop::Gitlab::DuplicateSpecLocation do
let(:spec_file_path) { full_path('ee/spec/controllers/foo_spec.rb') }
it 'registers no offenses' do
- expect_no_offenses(<<~SOURCE.strip_indent, spec_file_path)
+ expect_no_offenses(<<~SOURCE, spec_file_path)
describe 'Foo' do
end
SOURCE
@@ -65,7 +65,7 @@ describe RuboCop::Cop::Gitlab::DuplicateSpecLocation do
end
it 'marks the describe as offending' do
- expect_offense(<<~SOURCE.strip_indent, spec_file_path)
+ expect_offense(<<~SOURCE, spec_file_path)
describe 'Foo' do
^^^^^^^^^^^^^^ Duplicate spec location in `ee/spec/controllers/ee/foo_spec.rb`.
end
@@ -78,7 +78,7 @@ describe RuboCop::Cop::Gitlab::DuplicateSpecLocation do
let(:spec_file_path) { full_path('ee/spec/controllers/ee/foo_spec.rb') }
it 'registers no offenses' do
- expect_no_offenses(<<~SOURCE.strip_indent, spec_file_path)
+ expect_no_offenses(<<~SOURCE, spec_file_path)
describe 'Foo' do
end
SOURCE
@@ -94,7 +94,7 @@ describe RuboCop::Cop::Gitlab::DuplicateSpecLocation do
end
it 'marks the describe as offending' do
- expect_offense(<<~SOURCE.strip_indent, spec_file_path)
+ expect_offense(<<~SOURCE, spec_file_path)
describe 'Foo' do
^^^^^^^^^^^^^^ Duplicate spec location in `ee/spec/controllers/foo_spec.rb`.
end