diff options
Diffstat (limited to 'spec/rubocop/cop/migration')
9 files changed, 4 insertions, 40 deletions
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 7cc88946cf1..c2f0053718a 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 @@ -4,8 +4,6 @@ require 'rubocop_spec_helper' require_relative '../../../../rubocop/cop/migration/add_columns_to_wide_tables' RSpec.describe RuboCop::Cop::Migration::AddColumnsToWideTables do - let(:cop) { described_class.new } - context 'when outside of a migration' do it 'does not register any offenses' do expect_no_offenses(<<~RUBY) 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 aa39f5f1603..98cfcb5c2e2 100644 --- a/spec/rubocop/cop/migration/add_concurrent_foreign_key_spec.rb +++ b/spec/rubocop/cop/migration/add_concurrent_foreign_key_spec.rb @@ -4,8 +4,6 @@ require 'rubocop_spec_helper' require_relative '../../../../rubocop/cop/migration/add_concurrent_foreign_key' RSpec.describe RuboCop::Cop::Migration::AddConcurrentForeignKey do - let(:cop) { described_class.new } - context 'when outside of a migration' do it 'does not register any offenses' do expect_no_offenses('def up; add_foreign_key(:projects, :users, column: :user_id); end') 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 a6a072e2caf..032cc12ab94 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 @@ -78,30 +78,6 @@ RSpec.describe RuboCop::Cop::Migration::AddLimitToTextColumns do end RUBY end - - context 'for migrations before 2021_09_10_00_00_00' do - it 'when limit: attribute is used (which is not supported yet for this version): registers an offense' do - allow(cop).to receive(:version).and_return(described_class::TEXT_LIMIT_ATTRIBUTE_ALLOWED_SINCE - 5) - - expect_offense(<<~RUBY) - class TestTextLimits < ActiveRecord::Migration[6.0] - def up - create_table :test_text_limit_attribute do |t| - t.integer :test_id, null: false - t.text :name, limit: 100 - ^^^^ Text columns should always have a limit set (255 is suggested). Using limit: is not supported in this version. You can add a limit to a `text` column by using `add_text_limit` or `.text_limit` inside `create_table` - end - - create_table_with_constraints :test_text_limit_attribute do |t| - t.integer :test_id, null: false - t.text :name, limit: 100 - ^^^^ Text columns should always have a limit set (255 is suggested). Using limit: is not supported in this version. You can add a limit to a `text` column by using `add_text_limit` or `.text_limit` inside `create_table` - end - end - end - RUBY - end - end end context 'when text array columns are defined without a limit' do diff --git a/spec/rubocop/cop/migration/add_reference_spec.rb b/spec/rubocop/cop/migration/add_reference_spec.rb index bb3fe7068b4..7e6d14261c8 100644 --- a/spec/rubocop/cop/migration/add_reference_spec.rb +++ b/spec/rubocop/cop/migration/add_reference_spec.rb @@ -4,8 +4,6 @@ require 'rubocop_spec_helper' require_relative '../../../../rubocop/cop/migration/add_reference' RSpec.describe RuboCop::Cop::Migration::AddReference do - let(:cop) { described_class.new } - context 'when outside of a migration' do it 'does not register any offenses' do expect_no_offenses(<<~RUBY) diff --git a/spec/rubocop/cop/migration/background_migrations_spec.rb b/spec/rubocop/cop/migration/background_migrations_spec.rb index 681bbd84562..78c38f669ad 100644 --- a/spec/rubocop/cop/migration/background_migrations_spec.rb +++ b/spec/rubocop/cop/migration/background_migrations_spec.rb @@ -4,8 +4,6 @@ require 'rubocop_spec_helper' require_relative '../../../../rubocop/cop/migration/background_migrations' RSpec.describe RuboCop::Cop::Migration::BackgroundMigrations do - let(:cop) { described_class.new } - context 'when queue_background_migration_jobs_by_range_at_intervals is used' do it 'registers an offense' do expect_offense(<<~RUBY) diff --git a/spec/rubocop/cop/migration/batch_migrations_post_only_spec.rb b/spec/rubocop/cop/migration/batch_migrations_post_only_spec.rb index b5e2e83e788..a33557dc1ce 100644 --- a/spec/rubocop/cop/migration/batch_migrations_post_only_spec.rb +++ b/spec/rubocop/cop/migration/batch_migrations_post_only_spec.rb @@ -4,8 +4,6 @@ require 'rubocop_spec_helper' require_relative '../../../../rubocop/cop/migration/batch_migrations_post_only' RSpec.describe RuboCop::Cop::Migration::BatchMigrationsPostOnly do - let(:cop) { described_class.new } - before do allow(cop).to receive(:in_post_deployment_migration?).and_return post_migration? end diff --git a/spec/rubocop/cop/migration/create_table_with_foreign_keys_spec.rb b/spec/rubocop/cop/migration/create_table_with_foreign_keys_spec.rb index 072edb5827b..feea5cb3958 100644 --- a/spec/rubocop/cop/migration/create_table_with_foreign_keys_spec.rb +++ b/spec/rubocop/cop/migration/create_table_with_foreign_keys_spec.rb @@ -4,8 +4,6 @@ require 'rubocop_spec_helper' require_relative '../../../../rubocop/cop/migration/create_table_with_foreign_keys' RSpec.describe RuboCop::Cop::Migration::CreateTableWithForeignKeys do - let(:cop) { described_class.new } - context 'outside of a migration' do it 'does not register any offenses' do expect_no_offenses(<<~RUBY) @@ -148,9 +146,11 @@ RSpec.describe RuboCop::Cop::Migration::CreateTableWithForeignKeys do users web_hook_logs ].each do |table| - let(:table_name) { table } + context "with #{table}" do + let(:table_name) { table } - it_behaves_like 'target to high traffic table', dsl_method, table + it_behaves_like 'target to high traffic table', dsl_method, table + end end end diff --git a/spec/rubocop/cop/migration/schedule_async_spec.rb b/spec/rubocop/cop/migration/schedule_async_spec.rb index 59e03db07c0..30f774c48b0 100644 --- a/spec/rubocop/cop/migration/schedule_async_spec.rb +++ b/spec/rubocop/cop/migration/schedule_async_spec.rb @@ -5,7 +5,6 @@ require 'rubocop_spec_helper' require_relative '../../../../rubocop/cop/migration/schedule_async' RSpec.describe RuboCop::Cop::Migration::ScheduleAsync do - let(:cop) { described_class.new } let(:source) do <<~SOURCE def up 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 005d3fb6b2a..25381fc0281 100644 --- a/spec/rubocop/cop/migration/update_column_in_batches_spec.rb +++ b/spec/rubocop/cop/migration/update_column_in_batches_spec.rb @@ -5,7 +5,6 @@ require 'rubocop_spec_helper' require_relative '../../../../rubocop/cop/migration/update_column_in_batches' 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 <<-END |