diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-06-22 16:22:15 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-06-22 16:22:15 +0300 |
commit | d30596226d11fdb1d306f1563417a52425f95951 (patch) | |
tree | 1f2093ae1bd0e4128d1bb7778008faae0ec93f25 /spec/rubocop/cop | |
parent | f855cbf6477f4e6febf57472d20206db92fe86d8 (diff) | |
parent | 03ccd39a0ccafe79df50702464ff02d3ca0312c4 (diff) |
Merge branch 'update-large-tables-cop' into 'master'
Disallow methods that copy data on large tables
See merge request gitlab-org/gitlab-ce!20021
Diffstat (limited to 'spec/rubocop/cop')
-rw-r--r-- | spec/rubocop/cop/migration/update_large_table_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/rubocop/cop/migration/update_large_table_spec.rb b/spec/rubocop/cop/migration/update_large_table_spec.rb index ef724fc8bad..5e08eb4f772 100644 --- a/spec/rubocop/cop/migration/update_large_table_spec.rb +++ b/spec/rubocop/cop/migration/update_large_table_spec.rb @@ -32,6 +32,14 @@ describe RuboCop::Cop::Migration::UpdateLargeTable do include_examples 'large tables', 'add_column_with_default' end + context 'for the change_column_type_concurrently method' do + include_examples 'large tables', 'change_column_type_concurrently' + end + + context 'for the rename_column_concurrently method' do + include_examples 'large tables', 'rename_column_concurrently' + end + context 'for the update_column_in_batches method' do include_examples 'large tables', 'update_column_in_batches' end @@ -60,6 +68,18 @@ describe RuboCop::Cop::Migration::UpdateLargeTable do expect(cop.offenses).to be_empty end + it 'registers no offense for change_column_type_concurrently' do + inspect_source("change_column_type_concurrently :#{table}, :column, default: true") + + expect(cop.offenses).to be_empty + end + + it 'registers no offense for update_column_in_batches' do + inspect_source("rename_column_concurrently :#{table}, :column, default: true") + + expect(cop.offenses).to be_empty + end + it 'registers no offense for update_column_in_batches' do inspect_source("add_column_with_default :#{table}, :column, default: true") |