diff options
Diffstat (limited to 'spec/services/notification_recipients/build_service_spec.rb')
-rw-r--r-- | spec/services/notification_recipients/build_service_spec.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/services/notification_recipients/build_service_spec.rb b/spec/services/notification_recipients/build_service_spec.rb index ff54d6ccd2f..899d23ec641 100644 --- a/spec/services/notification_recipients/build_service_spec.rb +++ b/spec/services/notification_recipients/build_service_spec.rb @@ -14,6 +14,9 @@ RSpec.describe NotificationRecipients::BuildService do shared_examples 'no N+1 queries' do it 'avoids N+1 queries', :request_store do + # existing N+1 due to multiple users having to be looked up in the project_authorizations table + threshold = project.private? ? 1 : 0 + create_user service.build_new_note_recipients(note) @@ -24,7 +27,7 @@ RSpec.describe NotificationRecipients::BuildService do create_user - expect { service.build_new_note_recipients(note) }.not_to exceed_query_limit(control_count) + expect { service.build_new_note_recipients(note) }.not_to exceed_query_limit(control_count).with_threshold(threshold) end end @@ -66,6 +69,9 @@ RSpec.describe NotificationRecipients::BuildService do shared_examples 'no N+1 queries' do it 'avoids N+1 queries', :request_store do + # existing N+1 due to multiple users having to be looked up in the project_authorizations table + threshold = project.private? ? 1 : 0 + create_user service.build_new_review_recipients(review) @@ -76,7 +82,7 @@ RSpec.describe NotificationRecipients::BuildService do create_user - expect { service.build_new_review_recipients(review) }.not_to exceed_query_limit(control_count) + expect { service.build_new_review_recipients(review) }.not_to exceed_query_limit(control_count).with_threshold(threshold) end end |