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/migration/remove_concurrent_index_spec.rb')
-rw-r--r--spec/rubocop/cop/migration/remove_concurrent_index_spec.rb22
1 files changed, 8 insertions, 14 deletions
diff --git a/spec/rubocop/cop/migration/remove_concurrent_index_spec.rb b/spec/rubocop/cop/migration/remove_concurrent_index_spec.rb
index 8da368d588c..8e29e51992c 100644
--- a/spec/rubocop/cop/migration/remove_concurrent_index_spec.rb
+++ b/spec/rubocop/cop/migration/remove_concurrent_index_spec.rb
@@ -5,8 +5,6 @@ require 'rubocop'
require_relative '../../../../rubocop/cop/migration/remove_concurrent_index'
RSpec.describe RuboCop::Cop::Migration::RemoveConcurrentIndex do
- include CopHelper
-
subject(:cop) { described_class.new }
context 'in migration' do
@@ -15,26 +13,22 @@ RSpec.describe RuboCop::Cop::Migration::RemoveConcurrentIndex do
end
it 'registers an offense when remove_concurrent_index is used inside a change method' do
- inspect_source('def change; remove_concurrent_index :table, :column; end')
-
- aggregate_failures do
- expect(cop.offenses.size).to eq(1)
- expect(cop.offenses.map(&:line)).to eq([1])
- end
+ expect_offense(<<~RUBY)
+ def change
+ ^^^^^^ `remove_concurrent_index` is not reversible [...]
+ remove_concurrent_index :table, :column
+ end
+ RUBY
end
it 'registers no offense when remove_concurrent_index is used inside an up method' do
- inspect_source('def up; remove_concurrent_index :table, :column; end')
-
- expect(cop.offenses.size).to eq(0)
+ expect_no_offenses('def up; remove_concurrent_index :table, :column; end')
end
end
context 'outside of migration' do
it 'registers no offense' do
- inspect_source('def change; remove_concurrent_index :table, :column; end')
-
- expect(cop.offenses.size).to eq(0)
+ expect_no_offenses('def change; remove_concurrent_index :table, :column; end')
end
end
end