diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /spec/services/notification_recipients/build_service_spec.rb | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) | |
download | gitlab-ce-859a6fb938bb9ee2a317c46dfa4fcc1af49608f0.tar.gz |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'spec/services/notification_recipients/build_service_spec.rb')
-rw-r--r-- | spec/services/notification_recipients/build_service_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/services/notification_recipients/build_service_spec.rb b/spec/services/notification_recipients/build_service_spec.rb index cc08f9fceff..ff54d6ccd2f 100644 --- a/spec/services/notification_recipients/build_service_spec.rb +++ b/spec/services/notification_recipients/build_service_spec.rb @@ -110,4 +110,28 @@ RSpec.describe NotificationRecipients::BuildService do end end end + + describe '#build_requested_review_recipients' do + let(:merge_request) { create(:merge_request, source_project: project, target_project: project) } + + before do + merge_request.reviewers.push(assignee) + end + + shared_examples 'no N+1 queries' do + it 'avoids N+1 queries', :request_store do + create_user + + service.build_requested_review_recipients(note) + + control_count = ActiveRecord::QueryRecorder.new do + service.build_requested_review_recipients(note) + end + + create_user + + expect { service.build_requested_review_recipients(note) }.not_to exceed_query_limit(control_count) + end + end + end end |