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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
561bc570
Commit
561bc570
authored
Jul 19, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test for checking queries with different ref
parent
b84eb343
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
6 deletions
+27
-6
spec/serializers/pipeline_serializer_spec.rb
spec/serializers/pipeline_serializer_spec.rb
+27
-6
No files found.
spec/serializers/pipeline_serializer_spec.rb
View file @
561bc570
...
...
@@ -108,14 +108,35 @@ describe PipelineSerializer do
end
end
shared_examples
'no N+1 queries'
do
it
'verifies number of queries'
,
:request_store
do
recorded
=
ActiveRecord
::
QueryRecorder
.
new
{
subject
}
expect
(
recorded
.
count
).
to
be_within
(
1
).
of
(
59
)
expect
(
recorded
.
cached_count
).
to
eq
(
0
)
end
end
context
'with the same ref'
do
let
(
:ref
)
{
'feature'
}
it_behaves_like
'no N+1 queries'
end
context
'with different refs'
do
def
ref
@sequence
||=
0
@sequence
+=
1
"feature-
#{
@sequence
}
"
end
it_behaves_like
'no N+1 queries'
end
def
create_pipeline
(
status
)
create
(
:ci_empty_pipeline
,
project:
project
,
status:
status
).
tap
do
|
pipeline
|
create
(
:ci_empty_pipeline
,
project:
project
,
status:
status
,
ref:
ref
).
tap
do
|
pipeline
|
Ci
::
Build
::
AVAILABLE_STATUSES
.
each
do
|
status
|
create_build
(
pipeline
,
status
,
status
)
end
...
...
@@ -125,7 +146,7 @@ describe PipelineSerializer do
def
create_build
(
pipeline
,
stage
,
status
)
create
(
:ci_build
,
:tags
,
:triggered
,
:artifacts
,
pipeline:
pipeline
,
stage:
stage
,
name:
stage
,
status:
status
)
name:
stage
,
status:
status
,
ref:
pipeline
.
ref
)
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