diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-09-14 17:46:28 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-09-14 17:46:28 +0200 |
commit | 9c300fd98d05b32efac5d40e486462269414341f (patch) | |
tree | ebcc82a6ef38688211a14e5e925fb0c877bdacd9 | |
parent | 6dbd21abacadf055b75f02525c10477c84b74ee8 (diff) | |
download | gitlab-ce-9c300fd98d05b32efac5d40e486462269414341f.tar.gz |
Use the new query-recorder features as a PoCbvl-extend-query-recorder
-rw-r--r-- | spec/features/milestones/show_spec.rb | 4 | ||||
-rw-r--r-- | spec/requests/api/projects_spec.rb | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/spec/features/milestones/show_spec.rb b/spec/features/milestones/show_spec.rb index 624f13922ed..50c5e0bb65f 100644 --- a/spec/features/milestones/show_spec.rb +++ b/spec/features/milestones/show_spec.rb @@ -18,9 +18,9 @@ describe 'Milestone show' do it 'avoids N+1 database queries' do create(:labeled_issue, issue_params) - control_count = ActiveRecord::QueryRecorder.new { visit_milestone }.count + control = ActiveRecord::QueryRecorder.new { visit_milestone } create_list(:labeled_issue, 10, issue_params) - expect { visit_milestone }.not_to exceed_query_limit(control_count) + expect { visit_milestone }.not_to exceed_query_limit(control) end end diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 9602584f546..92e7d797cbd 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -54,9 +54,9 @@ describe API::Projects do shared_examples_for 'projects response without N + 1 queries' do it 'avoids N + 1 queries' do - control_count = ActiveRecord::QueryRecorder.new do + control = ActiveRecord::QueryRecorder.new do get api('/projects', current_user) - end.count + end if defined?(additional_project) additional_project @@ -66,7 +66,7 @@ describe API::Projects do expect do get api('/projects', current_user) - end.not_to exceed_query_limit(control_count + 8) + end.not_to exceed_query_limit(control).with_threshold(8) end end |