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')
-rw-r--r--spec/rubocop/cop/migration/add_column_with_default_spec.rb7
-rw-r--r--spec/rubocop/cop/migration/add_columns_to_wide_tables_spec.rb5
-rw-r--r--spec/rubocop/cop/migration/add_concurrent_foreign_key_spec.rb7
-rw-r--r--spec/rubocop/cop/migration/add_concurrent_index_spec.rb7
-rw-r--r--spec/rubocop/cop/migration/add_index_spec.rb7
-rw-r--r--spec/rubocop/cop/migration/add_limit_to_text_columns_spec.rb6
-rw-r--r--spec/rubocop/cop/migration/add_reference_spec.rb7
-rw-r--r--spec/rubocop/cop/migration/add_timestamps_spec.rb7
-rw-r--r--spec/rubocop/cop/migration/datetime_spec.rb7
-rw-r--r--spec/rubocop/cop/migration/drop_table_spec.rb74
-rw-r--r--spec/rubocop/cop/migration/hash_index_spec.rb7
-rw-r--r--spec/rubocop/cop/migration/prevent_strings_spec.rb6
-rw-r--r--spec/rubocop/cop/migration/remove_column_spec.rb7
-rw-r--r--spec/rubocop/cop/migration/remove_concurrent_index_spec.rb7
-rw-r--r--spec/rubocop/cop/migration/remove_index_spec.rb7
-rw-r--r--spec/rubocop/cop/migration/safer_boolean_column_spec.rb7
-rw-r--r--spec/rubocop/cop/migration/schedule_async_spec.rb2
-rw-r--r--spec/rubocop/cop/migration/timestamps_spec.rb7
-rw-r--r--spec/rubocop/cop/migration/update_column_in_batches_spec.rb2
-rw-r--r--spec/rubocop/cop/migration/with_lock_retries_disallowed_method_spec.rb7
-rw-r--r--spec/rubocop/cop/migration/with_lock_retries_with_change_spec.rb7
21 files changed, 100 insertions, 100 deletions
diff --git a/spec/rubocop/cop/migration/add_column_with_default_spec.rb b/spec/rubocop/cop/migration/add_column_with_default_spec.rb
index 5d4fc59fb95..50af344e0d4 100644
--- a/spec/rubocop/cop/migration/add_column_with_default_spec.rb
+++ b/spec/rubocop/cop/migration/add_column_with_default_spec.rb
@@ -1,13 +1,10 @@
# frozen_string_literal: true
-require 'spec_helper'
-
+require 'fast_spec_helper'
require 'rubocop'
-require 'rubocop/rspec/support'
-
require_relative '../../../../rubocop/cop/migration/add_column_with_default'
-describe RuboCop::Cop::Migration::AddColumnWithDefault do
+RSpec.describe RuboCop::Cop::Migration::AddColumnWithDefault, type: :rubocop do
include CopHelper
let(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/add_columns_to_wide_tables_spec.rb b/spec/rubocop/cop/migration/add_columns_to_wide_tables_spec.rb
index 5b179168eab..6ae4fb21126 100644
--- a/spec/rubocop/cop/migration/add_columns_to_wide_tables_spec.rb
+++ b/spec/rubocop/cop/migration/add_columns_to_wide_tables_spec.rb
@@ -1,11 +1,10 @@
# frozen_string_literal: true
-require 'spec_helper'
+require 'fast_spec_helper'
require 'rubocop'
-
require_relative '../../../../rubocop/cop/migration/add_columns_to_wide_tables'
-describe RuboCop::Cop::Migration::AddColumnsToWideTables do
+RSpec.describe RuboCop::Cop::Migration::AddColumnsToWideTables, type: :rubocop do
include CopHelper
let(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/add_concurrent_foreign_key_spec.rb b/spec/rubocop/cop/migration/add_concurrent_foreign_key_spec.rb
index dfc3898af24..b43d44dba65 100644
--- a/spec/rubocop/cop/migration/add_concurrent_foreign_key_spec.rb
+++ b/spec/rubocop/cop/migration/add_concurrent_foreign_key_spec.rb
@@ -1,13 +1,10 @@
# frozen_string_literal: true
-require 'spec_helper'
-
+require 'fast_spec_helper'
require 'rubocop'
-require 'rubocop/rspec/support'
-
require_relative '../../../../rubocop/cop/migration/add_concurrent_foreign_key'
-describe RuboCop::Cop::Migration::AddConcurrentForeignKey do
+RSpec.describe RuboCop::Cop::Migration::AddConcurrentForeignKey, type: :rubocop do
include CopHelper
let(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/add_concurrent_index_spec.rb b/spec/rubocop/cop/migration/add_concurrent_index_spec.rb
index 9812e64216f..cef5295830c 100644
--- a/spec/rubocop/cop/migration/add_concurrent_index_spec.rb
+++ b/spec/rubocop/cop/migration/add_concurrent_index_spec.rb
@@ -1,13 +1,10 @@
# frozen_string_literal: true
-require 'spec_helper'
-
+require 'fast_spec_helper'
require 'rubocop'
-require 'rubocop/rspec/support'
-
require_relative '../../../../rubocop/cop/migration/add_concurrent_index'
-describe RuboCop::Cop::Migration::AddConcurrentIndex do
+RSpec.describe RuboCop::Cop::Migration::AddConcurrentIndex, type: :rubocop do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/add_index_spec.rb b/spec/rubocop/cop/migration/add_index_spec.rb
index ca1aadb381b..6bb78a7f3c7 100644
--- a/spec/rubocop/cop/migration/add_index_spec.rb
+++ b/spec/rubocop/cop/migration/add_index_spec.rb
@@ -1,13 +1,10 @@
# frozen_string_literal: true
-require 'spec_helper'
-
+require 'fast_spec_helper'
require 'rubocop'
-require 'rubocop/rspec/support'
-
require_relative '../../../../rubocop/cop/migration/add_index'
-describe RuboCop::Cop::Migration::AddIndex do
+RSpec.describe RuboCop::Cop::Migration::AddIndex, type: :rubocop do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/add_limit_to_text_columns_spec.rb b/spec/rubocop/cop/migration/add_limit_to_text_columns_spec.rb
index 39ca9ace73d..5f0ca419548 100644
--- a/spec/rubocop/cop/migration/add_limit_to_text_columns_spec.rb
+++ b/spec/rubocop/cop/migration/add_limit_to_text_columns_spec.rb
@@ -1,12 +1,10 @@
# frozen_string_literal: true
-require 'spec_helper'
+require 'fast_spec_helper'
require 'rubocop'
-require 'rubocop/rspec/support'
-
require_relative '../../../../rubocop/cop/migration/add_limit_to_text_columns'
-describe RuboCop::Cop::Migration::AddLimitToTextColumns do
+RSpec.describe RuboCop::Cop::Migration::AddLimitToTextColumns, type: :rubocop do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/add_reference_spec.rb b/spec/rubocop/cop/migration/add_reference_spec.rb
index 03348ecc744..fab70d74b55 100644
--- a/spec/rubocop/cop/migration/add_reference_spec.rb
+++ b/spec/rubocop/cop/migration/add_reference_spec.rb
@@ -1,13 +1,10 @@
# frozen_string_literal: true
-require 'spec_helper'
-
+require 'fast_spec_helper'
require 'rubocop'
-require 'rubocop/rspec/support'
-
require_relative '../../../../rubocop/cop/migration/add_reference'
-describe RuboCop::Cop::Migration::AddReference do
+RSpec.describe RuboCop::Cop::Migration::AddReference, type: :rubocop do
include CopHelper
let(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/add_timestamps_spec.rb b/spec/rubocop/cop/migration/add_timestamps_spec.rb
index a3314d878e5..c18b6b06ded 100644
--- a/spec/rubocop/cop/migration/add_timestamps_spec.rb
+++ b/spec/rubocop/cop/migration/add_timestamps_spec.rb
@@ -1,13 +1,10 @@
# frozen_string_literal: true
-require 'spec_helper'
-
+require 'fast_spec_helper'
require 'rubocop'
-require 'rubocop/rspec/support'
-
require_relative '../../../../rubocop/cop/migration/add_timestamps'
-describe RuboCop::Cop::Migration::AddTimestamps do
+RSpec.describe RuboCop::Cop::Migration::AddTimestamps, type: :rubocop do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/datetime_spec.rb b/spec/rubocop/cop/migration/datetime_spec.rb
index e3023406dce..c5f6fd503ec 100644
--- a/spec/rubocop/cop/migration/datetime_spec.rb
+++ b/spec/rubocop/cop/migration/datetime_spec.rb
@@ -1,13 +1,10 @@
# frozen_string_literal: true
-require 'spec_helper'
-
+require 'fast_spec_helper'
require 'rubocop'
-require 'rubocop/rspec/support'
-
require_relative '../../../../rubocop/cop/migration/datetime'
-describe RuboCop::Cop::Migration::Datetime do
+RSpec.describe RuboCop::Cop::Migration::Datetime, type: :rubocop do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/drop_table_spec.rb b/spec/rubocop/cop/migration/drop_table_spec.rb
index 4fe7fc8c5a5..44a1106ba62 100644
--- a/spec/rubocop/cop/migration/drop_table_spec.rb
+++ b/spec/rubocop/cop/migration/drop_table_spec.rb
@@ -7,7 +7,7 @@ require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/migration/drop_table'
-describe RuboCop::Cop::Migration::DropTable do
+RSpec.describe RuboCop::Cop::Migration::DropTable do
include CopHelper
subject(:cop) { described_class.new }
@@ -17,20 +17,70 @@ describe RuboCop::Cop::Migration::DropTable do
allow(cop).to receive(:in_deployment_migration?).and_return(true)
end
- it 'registers an offense' do
- expect_offense(<<~PATTERN)
- def change
- drop_table :table
- ^^^^^^^^^^ #{described_class::MSG}
-
- add_column(:users, :username, :text)
+ context 'with drop_table DSL method' do
+ context 'when in down method' do
+ it 'does not register an offense' do
+ expect_no_offenses(<<~PATTERN)
+ def down
+ drop_table :table
+ end
+ PATTERN
+ end
+ end
- execute "DROP TABLE table"
- ^^^^^^^ #{described_class::MSG}
+ context 'when in up method' do
+ it 'registers an offense' do
+ expect_offense(<<~PATTERN)
+ def up
+ drop_table :table
+ ^^^^^^^^^^ #{described_class::MSG}
+ end
+ PATTERN
+ end
+ end
- execute "CREATE UNIQUE INDEX email_index ON users (email);"
+ context 'when in change method' do
+ it 'registers an offense' do
+ expect_offense(<<~PATTERN)
+ def change
+ drop_table :table
+ ^^^^^^^^^^ #{described_class::MSG}
+ end
+ PATTERN
end
- PATTERN
+ end
+ end
+
+ context 'with DROP TABLE SQL literal' do
+ it 'does not register an offense' do
+ expect_no_offenses(<<~PATTERN)
+ def down
+ execute "DROP TABLE table"
+ end
+ PATTERN
+ end
+ end
+
+ context 'when in up method' do
+ it 'registers an offense' do
+ expect_offense(<<~PATTERN)
+ def up
+ execute "DROP TABLE table"
+ ^^^^^^^ #{described_class::MSG}
+ end
+ PATTERN
+ end
+ end
+
+ context 'when in change method' do
+ it 'registers an offense' do
+ expect_offense(<<~PATTERN)
+ def change
+ execute "DROP TABLE table"
+ ^^^^^^^ #{described_class::MSG}
+ end
+ PATTERN
+ end
end
end
diff --git a/spec/rubocop/cop/migration/hash_index_spec.rb b/spec/rubocop/cop/migration/hash_index_spec.rb
index e8b05a94653..3d26ea41d08 100644
--- a/spec/rubocop/cop/migration/hash_index_spec.rb
+++ b/spec/rubocop/cop/migration/hash_index_spec.rb
@@ -1,13 +1,10 @@
# frozen_string_literal: true
-require 'spec_helper'
-
+require 'fast_spec_helper'
require 'rubocop'
-require 'rubocop/rspec/support'
-
require_relative '../../../../rubocop/cop/migration/hash_index'
-describe RuboCop::Cop::Migration::HashIndex do
+RSpec.describe RuboCop::Cop::Migration::HashIndex, type: :rubocop do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/prevent_strings_spec.rb b/spec/rubocop/cop/migration/prevent_strings_spec.rb
index d0e97874aed..6882dca1926 100644
--- a/spec/rubocop/cop/migration/prevent_strings_spec.rb
+++ b/spec/rubocop/cop/migration/prevent_strings_spec.rb
@@ -1,12 +1,10 @@
# frozen_string_literal: true
-require 'spec_helper'
+require 'fast_spec_helper'
require 'rubocop'
-require 'rubocop/rspec/support'
-
require_relative '../../../../rubocop/cop/migration/prevent_strings'
-describe RuboCop::Cop::Migration::PreventStrings do
+RSpec.describe RuboCop::Cop::Migration::PreventStrings, type: :rubocop do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/remove_column_spec.rb b/spec/rubocop/cop/migration/remove_column_spec.rb
index bc2fa04ce64..7ef5556d8d7 100644
--- a/spec/rubocop/cop/migration/remove_column_spec.rb
+++ b/spec/rubocop/cop/migration/remove_column_spec.rb
@@ -1,13 +1,10 @@
# frozen_string_literal: true
-require 'spec_helper'
-
+require 'fast_spec_helper'
require 'rubocop'
-require 'rubocop/rspec/support'
-
require_relative '../../../../rubocop/cop/migration/remove_column'
-describe RuboCop::Cop::Migration::RemoveColumn do
+RSpec.describe RuboCop::Cop::Migration::RemoveColumn, type: :rubocop do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/remove_concurrent_index_spec.rb b/spec/rubocop/cop/migration/remove_concurrent_index_spec.rb
index 9de4c756f12..f70febb571d 100644
--- a/spec/rubocop/cop/migration/remove_concurrent_index_spec.rb
+++ b/spec/rubocop/cop/migration/remove_concurrent_index_spec.rb
@@ -1,13 +1,10 @@
# frozen_string_literal: true
-require 'spec_helper'
-
+require 'fast_spec_helper'
require 'rubocop'
-require 'rubocop/rspec/support'
-
require_relative '../../../../rubocop/cop/migration/remove_concurrent_index'
-describe RuboCop::Cop::Migration::RemoveConcurrentIndex do
+RSpec.describe RuboCop::Cop::Migration::RemoveConcurrentIndex, type: :rubocop do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/remove_index_spec.rb b/spec/rubocop/cop/migration/remove_index_spec.rb
index d343d27484a..cc82306a0f5 100644
--- a/spec/rubocop/cop/migration/remove_index_spec.rb
+++ b/spec/rubocop/cop/migration/remove_index_spec.rb
@@ -1,13 +1,10 @@
# frozen_string_literal: true
-require 'spec_helper'
-
+require 'fast_spec_helper'
require 'rubocop'
-require 'rubocop/rspec/support'
-
require_relative '../../../../rubocop/cop/migration/remove_index'
-describe RuboCop::Cop::Migration::RemoveIndex do
+RSpec.describe RuboCop::Cop::Migration::RemoveIndex, type: :rubocop do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/safer_boolean_column_spec.rb b/spec/rubocop/cop/migration/safer_boolean_column_spec.rb
index b27a4cd4f80..013f2edc5e9 100644
--- a/spec/rubocop/cop/migration/safer_boolean_column_spec.rb
+++ b/spec/rubocop/cop/migration/safer_boolean_column_spec.rb
@@ -1,13 +1,10 @@
# frozen_string_literal: true
-require 'spec_helper'
-
+require 'fast_spec_helper'
require 'rubocop'
-require 'rubocop/rspec/support'
-
require_relative '../../../../rubocop/cop/migration/safer_boolean_column'
-describe RuboCop::Cop::Migration::SaferBooleanColumn do
+RSpec.describe RuboCop::Cop::Migration::SaferBooleanColumn, type: :rubocop do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/schedule_async_spec.rb b/spec/rubocop/cop/migration/schedule_async_spec.rb
index 3453f1c51cc..a7246dfa73a 100644
--- a/spec/rubocop/cop/migration/schedule_async_spec.rb
+++ b/spec/rubocop/cop/migration/schedule_async_spec.rb
@@ -7,7 +7,7 @@ require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/migration/schedule_async'
-describe RuboCop::Cop::Migration::ScheduleAsync do
+RSpec.describe RuboCop::Cop::Migration::ScheduleAsync do
include CopHelper
let(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/timestamps_spec.rb b/spec/rubocop/cop/migration/timestamps_spec.rb
index d03c75e7cfc..14b3cb36cf8 100644
--- a/spec/rubocop/cop/migration/timestamps_spec.rb
+++ b/spec/rubocop/cop/migration/timestamps_spec.rb
@@ -1,13 +1,10 @@
# frozen_string_literal: true
-require 'spec_helper'
-
+require 'fast_spec_helper'
require 'rubocop'
-require 'rubocop/rspec/support'
-
require_relative '../../../../rubocop/cop/migration/timestamps'
-describe RuboCop::Cop::Migration::Timestamps do
+RSpec.describe RuboCop::Cop::Migration::Timestamps, type: :rubocop do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/update_column_in_batches_spec.rb b/spec/rubocop/cop/migration/update_column_in_batches_spec.rb
index f72efaf2eb2..5d96e8048bf 100644
--- a/spec/rubocop/cop/migration/update_column_in_batches_spec.rb
+++ b/spec/rubocop/cop/migration/update_column_in_batches_spec.rb
@@ -7,7 +7,7 @@ require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/migration/update_column_in_batches'
-describe RuboCop::Cop::Migration::UpdateColumnInBatches do
+RSpec.describe RuboCop::Cop::Migration::UpdateColumnInBatches do
let(:cop) { described_class.new }
let(:tmp_rails_root) { Rails.root.join('tmp', 'rails_root') }
let(:migration_code) do
diff --git a/spec/rubocop/cop/migration/with_lock_retries_disallowed_method_spec.rb b/spec/rubocop/cop/migration/with_lock_retries_disallowed_method_spec.rb
index 48570c1c8d8..11e4d784617 100644
--- a/spec/rubocop/cop/migration/with_lock_retries_disallowed_method_spec.rb
+++ b/spec/rubocop/cop/migration/with_lock_retries_disallowed_method_spec.rb
@@ -1,13 +1,10 @@
# frozen_string_literal: true
-require 'spec_helper'
-
+require 'fast_spec_helper'
require 'rubocop'
-require 'rubocop/rspec/support'
-
require_relative '../../../../rubocop/cop/migration/with_lock_retries_disallowed_method'
-describe RuboCop::Cop::Migration::WithLockRetriesDisallowedMethod do
+RSpec.describe RuboCop::Cop::Migration::WithLockRetriesDisallowedMethod, type: :rubocop do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/with_lock_retries_with_change_spec.rb b/spec/rubocop/cop/migration/with_lock_retries_with_change_spec.rb
index 75a1f939a9f..93b96f3a20e 100644
--- a/spec/rubocop/cop/migration/with_lock_retries_with_change_spec.rb
+++ b/spec/rubocop/cop/migration/with_lock_retries_with_change_spec.rb
@@ -1,13 +1,10 @@
# frozen_string_literal: true
-require 'spec_helper'
-
+require 'fast_spec_helper'
require 'rubocop'
-require 'rubocop/rspec/support'
-
require_relative '../../../../rubocop/cop/migration/with_lock_retries_with_change'
-describe RuboCop::Cop::Migration::WithLockRetriesWithChange do
+RSpec.describe RuboCop::Cop::Migration::WithLockRetriesWithChange, type: :rubocop do
include CopHelper
subject(:cop) { described_class.new }