Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
f78cd547
Commit
f78cd547
authored
May 16, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable RequestStore for PipelinesController#show specs
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
939f0088
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
spec/controllers/projects/pipelines_controller_spec.rb
spec/controllers/projects/pipelines_controller_spec.rb
+2
-2
spec/support/request_store.rb
spec/support/request_store.rb
+6
-0
No files found.
spec/controllers/projects/pipelines_controller_spec.rb
View file @
f78cd547
...
@@ -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
+
1
2
)
expect
{
get_pipeline_json
}.
not_to
exceed_query_limit
(
control_count
+
2
)
end
end
end
end
...
...
spec/support/request_store.rb
View file @
f78cd547
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment