diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /spec/rubocop/cop/migration/add_column_with_default_spec.rb | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'spec/rubocop/cop/migration/add_column_with_default_spec.rb')
-rw-r--r-- | spec/rubocop/cop/migration/add_column_with_default_spec.rb | 45 |
1 files changed, 8 insertions, 37 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 a8cf965a3ef..5d4fc59fb95 100644 --- a/spec/rubocop/cop/migration/add_column_with_default_spec.rb +++ b/spec/rubocop/cop/migration/add_column_with_default_spec.rb @@ -27,44 +27,15 @@ describe RuboCop::Cop::Migration::AddColumnWithDefault do allow(cop).to receive(:in_migration?).and_return(true) end - let(:offense) { '`add_column_with_default` without `allow_null: true` may cause prolonged lock situations and downtime, see https://gitlab.com/gitlab-org/gitlab/issues/38060' } + let(:offense) { '`add_column_with_default` is deprecated, use `add_column` instead' } - context 'for blacklisted table' do - it 'registers an offense when specifying allow_null: false' do - expect_offense(<<~RUBY) - def up - add_column_with_default(:merge_request_diff_files, :artifacts, :boolean, default: true, allow_null: false) - ^^^^^^^^^^^^^^^^^^^^^^^ #{offense} - end - RUBY - end - - it 'registers no offense when specifying allow_null: true' do - expect_no_offenses(<<~RUBY) - def up - add_column_with_default(:merge_request_diff_files, :artifacts, :boolean, default: true, allow_null: true) - end - RUBY - end - - it 'registers an offense when allow_null is not specified' do - expect_offense(<<~RUBY) - def up - add_column_with_default(:merge_request_diff_files, :artifacts, :boolean, default: true) - ^^^^^^^^^^^^^^^^^^^^^^^ #{offense} - end - RUBY - end - end - - context 'for tables not on the blacklist' do - it 'registers no offense for application_settings (not on blacklist)' do - expect_no_offenses(<<~RUBY) - def up - add_column_with_default(:application_settings, :another_column, :boolean, default: true, allow_null: false) - end - RUBY - end + it 'registers an offense ' do + expect_offense(<<~RUBY) + def up + add_column_with_default(:merge_request_diff_files, :artifacts, :boolean, default: true, allow_null: false) + ^^^^^^^^^^^^^^^^^^^^^^^ #{offense} + end + RUBY end end end |