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_index_spec.rb')
-rw-r--r--spec/rubocop/cop/migration/remove_index_spec.rb22
1 files changed, 9 insertions, 13 deletions
diff --git a/spec/rubocop/cop/migration/remove_index_spec.rb b/spec/rubocop/cop/migration/remove_index_spec.rb
index 274c907ac41..c9797443276 100644
--- a/spec/rubocop/cop/migration/remove_index_spec.rb
+++ b/spec/rubocop/cop/migration/remove_index_spec.rb
@@ -5,30 +5,26 @@ require 'rubocop'
require_relative '../../../../rubocop/cop/migration/remove_index'
RSpec.describe RuboCop::Cop::Migration::RemoveIndex do
- include CopHelper
-
subject(:cop) { described_class.new }
- context 'in migration' do
+ context 'when in migration' do
before do
allow(cop).to receive(:in_migration?).and_return(true)
end
it 'registers an offense when remove_index is used' do
- inspect_source('def change; remove_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_index :table, :column
+ ^^^^^^^^^^^^ `remove_index` requires downtime, use `remove_concurrent_index` instead
+ end
+ RUBY
end
end
- context 'outside of migration' do
+ context 'when outside of migration' do
it 'registers no offense' do
- inspect_source('def change; remove_index :table, :column; end')
-
- expect(cop.offenses.size).to eq(0)
+ expect_no_offenses('def change; remove_index :table, :column; end')
end
end
end