From e8841e8dbc6a14af3ce98b7033136249dd9de265 Mon Sep 17 00:00:00 2001 From: Oswaldo Ferreira Date: Thu, 18 May 2017 17:14:48 -0300 Subject: Drop merge_check endpoint and use only MR show instead --- spec/controllers/projects/merge_requests_controller_spec.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'spec/controllers/projects') diff --git a/spec/controllers/projects/merge_requests_controller_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb index 0b3492a8fed..7fe2f190790 100644 --- a/spec/controllers/projects/merge_requests_controller_spec.rb +++ b/spec/controllers/projects/merge_requests_controller_spec.rb @@ -119,6 +119,15 @@ describe Projects::MergeRequestsController do expect(response).to match_response_schema('entities/merge_request') end end + + context 'number of queries' do + it 'verifies number of queries' do + recorded = ActiveRecord::QueryRecorder.new { go(format: :json) } + + expect(recorded.count).to be_within(1).of(94) + expect(recorded.cached_count).to eq(0) + end + end end describe "as diff" do -- cgit v1.2.1 From b3cf3d046b8a319c0dbca7cb9aeaea027c080e6f Mon Sep 17 00:00:00 2001 From: Oswaldo Ferreira Date: Fri, 19 May 2017 10:19:04 -0300 Subject: Make sure fixture creation does not affect query count test --- spec/controllers/projects/merge_requests_controller_spec.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'spec/controllers/projects') diff --git a/spec/controllers/projects/merge_requests_controller_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb index 7fe2f190790..f0dc6df15ee 100644 --- a/spec/controllers/projects/merge_requests_controller_spec.rb +++ b/spec/controllers/projects/merge_requests_controller_spec.rb @@ -122,9 +122,12 @@ describe Projects::MergeRequestsController do context 'number of queries' do it 'verifies number of queries' do + # pre-create objects + merge_request + recorded = ActiveRecord::QueryRecorder.new { go(format: :json) } - expect(recorded.count).to be_within(1).of(94) + expect(recorded.count).to be_within(1).of(51) expect(recorded.cached_count).to eq(0) end end -- cgit v1.2.1