diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-13 06:09:05 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-13 06:09:05 +0300 |
commit | 56a7627af0b4cc9fa9869bff88c8a3c81ca931c6 (patch) | |
tree | 47beee69e05889a30d4569192be3012d0ee2749c /spec/support | |
parent | 47d1f417f03aca055b2ba49c32bb6fb01c459831 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/shared_examples/models/concerns/bulk_insert_safe_shared_examples.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/spec/support/shared_examples/models/concerns/bulk_insert_safe_shared_examples.rb b/spec/support/shared_examples/models/concerns/bulk_insert_safe_shared_examples.rb index 0a2b6616bb4..78d0945ea63 100644 --- a/spec/support/shared_examples/models/concerns/bulk_insert_safe_shared_examples.rb +++ b/spec/support/shared_examples/models/concerns/bulk_insert_safe_shared_examples.rb @@ -1,6 +1,11 @@ # frozen_string_literal: true -RSpec.shared_examples 'a BulkInsertSafe model' do |target_class| +RSpec.shared_examples 'a BulkInsertSafe model' do |klass| + # Call `.dup` on the class passed in, as a test in this set of examples + # calls `belongs_to` on the class, thereby adding a new belongs_to + # relationship to the model that can break remaining specs in the test suite. + let(:target_class) { klass.dup } + # We consider all callbacks unsafe for bulk insertions unless we have explicitly # whitelisted them (esp. anything related to :save, :create, :commit etc.) let(:callback_method_blacklist) do |