summaryrefslogtreecommitdiff
path: root/spec/rubocop/cop/migration/add_concurrent_foreign_key_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/rubocop/cop/migration/add_concurrent_foreign_key_spec.rb')
-rw-r--r--spec/rubocop/cop/migration/add_concurrent_foreign_key_spec.rb10
1 files changed, 10 insertions, 0 deletions
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 b43d44dba65..aaf191a1b6b 100644
--- a/spec/rubocop/cop/migration/add_concurrent_foreign_key_spec.rb
+++ b/spec/rubocop/cop/migration/add_concurrent_foreign_key_spec.rb
@@ -36,5 +36,15 @@ RSpec.describe RuboCop::Cop::Migration::AddConcurrentForeignKey, type: :rubocop
expect(cop.offenses).to be_empty
end
+
+ it 'does not register an offense when `add_foreign_key` is within `with_lock_retries`' do
+ inspect_source <<~RUBY
+ with_lock_retries do
+ add_foreign_key :key, :projects, column: :project_id, on_delete: :cascade
+ end
+ RUBY
+
+ expect(cop.offenses).to be_empty
+ end
end
end