Commit f78cd547 authored by Rémy Coutable's avatar Rémy Coutable

Enable RequestStore for PipelinesController#show specs

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 939f0088
...@@ -50,13 +50,13 @@ describe Projects::PipelinesController do ...@@ -50,13 +50,13 @@ describe Projects::PipelinesController do
end end
context 'when the pipeline has multiple jobs' do context 'when the pipeline has multiple jobs' do
it 'does not perform N + 1 queries' do it 'does not perform N + 1 queries', :with_request_store do
control_count = ActiveRecord::QueryRecorder.new { get_pipeline_json }.count control_count = ActiveRecord::QueryRecorder.new { get_pipeline_json }.count
create(:ci_build, pipeline: pipeline) create(:ci_build, pipeline: pipeline)
# The plus 2 is needed to group and sort # The plus 2 is needed to group and sort
expect { get_pipeline_json }.not_to exceed_query_limit(control_count + 12) expect { get_pipeline_json }.not_to exceed_query_limit(control_count + 2)
end end
end end
......
...@@ -2,4 +2,10 @@ RSpec.configure do |config| ...@@ -2,4 +2,10 @@ RSpec.configure do |config|
config.before(:each) do config.before(:each) do
RequestStore.clear! RequestStore.clear!
end end
config.around(:each, :with_request_store) do |example|
RequestStore.begin!
example.run
RequestStore.end!
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment