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
227a664e
Commit
227a664e
authored
Apr 06, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Next round
parent
93f9e71b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
13 deletions
+11
-13
app/serializers/pipeline_serializer.rb
app/serializers/pipeline_serializer.rb
+7
-10
spec/serializers/pipeline_serializer_spec.rb
spec/serializers/pipeline_serializer_spec.rb
+4
-3
No files found.
app/serializers/pipeline_serializer.rb
View file @
227a664e
...
...
@@ -13,18 +13,15 @@ class PipelineSerializer < BaseSerializer
def
represent
(
resource
,
opts
=
{})
if
resource
.
is_a?
(
ActiveRecord
::
Relation
)
project_includes
=
[
{
namespace: :route
},
:route
]
resource
=
resource
.
includes
(
resource
=
resource
.
includes
([
:retryable_builds
,
:cancelable_statuses
,
:trigger_requests
)
resource
=
resource
.
includes
(
project:
project_includes
,
pending_builds:
[
:project
],
manual_actions:
{
project:
project_includes
},
artifacts:
{
project:
project_includes
}
)
:trigger_requests
,
:project
,
{
pending_builds: :project
},
{
manual_actions: :project
},
{
artifacts: :project
}
])
end
if
paginated?
...
...
spec/serializers/pipeline_serializer_spec.rb
View file @
227a664e
...
...
@@ -96,6 +96,7 @@ describe PipelineSerializer do
context
'number of queries'
do
let
(
:resource
)
{
Ci
::
Pipeline
.
all
}
let
(
:project
)
{
create
(
:empty_project
)
}
before
do
Ci
::
Pipeline
::
AVAILABLE_STATUSES
.
each
do
|
status
|
...
...
@@ -112,12 +113,12 @@ describe PipelineSerializer do
it
"verifies number of queries"
do
recorded
=
ActiveRecord
::
QueryRecorder
.
new
{
subject
}
expect
(
recorded
.
count
).
to
be_within
(
1
0
).
of
(
93
)
expect
(
recorded
.
cached_count
).
to
be_within
(
5
).
of
(
5
)
expect
(
recorded
.
count
).
to
be_within
(
1
).
of
(
50
)
expect
(
recorded
.
cached_count
).
to
eq
(
0
)
end
def
create_pipeline
(
status
)
create
(
:ci_empty_pipeline
,
status:
status
).
tap
do
|
pipeline
|
create
(
:ci_empty_pipeline
,
project:
project
,
status:
status
).
tap
do
|
pipeline
|
Ci
::
Build
::
AVAILABLE_STATUSES
.
each
do
|
status
|
create_build
(
pipeline
,
status
,
status
)
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