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
ae7f5faf
Commit
ae7f5faf
authored
Aug 19, 2019
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve nplusone spec for PipelinesController#show
parent
648e5a94
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
spec/controllers/projects/pipelines_controller_spec.rb
spec/controllers/projects/pipelines_controller_spec.rb
+11
-7
No files found.
spec/controllers/projects/pipelines_controller_spec.rb
View file @
ae7f5faf
...
...
@@ -177,18 +177,22 @@ describe Projects::PipelinesController do
end
it
'does not perform N + 1 queries'
do
# Set up all required variables
get_pipeline_json
control_count
=
ActiveRecord
::
QueryRecorder
.
new
{
get_pipeline_json
}.
count
create_build
(
'test'
,
1
,
'rspec 1'
)
create_build
(
'test'
,
1
,
'spinach 0'
)
create_build
(
'test'
,
1
,
'spinach 1'
)
create_build
(
'test'
,
1
,
'audit'
)
create_build
(
'post deploy'
,
3
,
'pages 1'
)
create_build
(
'post deploy'
,
3
,
'pages 2'
)
first_build
=
pipeline
.
builds
.
first
first_build
.
tag_list
<<
[
:hello
,
:world
]
create
(
:deployment
,
deployable:
first_build
)
second_build
=
pipeline
.
builds
.
second
second_build
.
tag_list
<<
[
:docker
,
:ruby
]
create
(
:deployment
,
deployable:
second_build
)
new_count
=
ActiveRecord
::
QueryRecorder
.
new
{
get_pipeline_json
}.
count
expect
(
new_count
).
to
be_within
(
1
2
).
of
(
control_count
)
expect
(
new_count
).
to
be_within
(
1
).
of
(
control_count
)
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