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
Tatuya Kamada
gitlab-ce
Commits
ccea4727
Commit
ccea4727
authored
Dec 15, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix pipeline detailed status serializer and entities
parent
c7db5b3e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
15 deletions
+21
-15
app/serializers/pipeline_entity.rb
app/serializers/pipeline_entity.rb
+7
-2
app/serializers/status_entity.rb
app/serializers/status_entity.rb
+1
-1
spec/serializers/pipeline_serializer_spec.rb
spec/serializers/pipeline_serializer_spec.rb
+9
-6
spec/serializers/status_entity_spec.rb
spec/serializers/status_entity_spec.rb
+4
-6
No files found.
app/serializers/pipeline_entity.rb
View file @
ccea4727
...
@@ -4,7 +4,7 @@ class PipelineEntity < Grape::Entity
...
@@ -4,7 +4,7 @@ class PipelineEntity < Grape::Entity
expose
:id
expose
:id
expose
:user
,
using:
UserEntity
expose
:user
,
using:
UserEntity
expose
:
url
do
|
pipeline
|
expose
:
path
do
|
pipeline
|
namespace_project_pipeline_path
(
namespace_project_pipeline_path
(
pipeline
.
project
.
namespace
,
pipeline
.
project
.
namespace
,
pipeline
.
project
,
pipeline
.
project
,
...
@@ -12,7 +12,12 @@ class PipelineEntity < Grape::Entity
...
@@ -12,7 +12,12 @@ class PipelineEntity < Grape::Entity
end
end
expose
:details
do
expose
:details
do
expose
:detailed_status
,
as: :status
,
using:
StatusEntity
expose
:status
do
|
pipeline
,
options
|
StatusEntity
.
represent
(
pipeline
.
detailed_status
(
request
.
user
),
options
)
end
expose
:duration
expose
:duration
expose
:finished_at
expose
:finished_at
expose
:stages
,
using:
PipelineStageEntity
expose
:stages
,
using:
PipelineStageEntity
...
...
app/serializers/status_entity.rb
View file @
ccea4727
class
StatusEntity
<
Grape
::
Entity
class
StatusEntity
<
Grape
::
Entity
include
RequestAwareEntity
include
RequestAwareEntity
expose
:icon
,
:text
,
:label
,
:title
expose
:icon
,
:text
,
:label
expose
:has_details?
,
as: :has_details
expose
:has_details?
,
as: :has_details
expose
:details_path
expose
:details_path
...
...
spec/serializers/pipeline_serializer_spec.rb
View file @
ccea4727
require
'spec_helper'
require
'spec_helper'
describe
PipelineSerializer
do
describe
PipelineSerializer
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
)
}
let
(
:serializer
)
do
let
(
:serializer
)
do
described_class
.
new
(
user:
user
)
described_class
.
new
(
user:
user
)
end
end
let
(
:pipelines
)
do
describe
'#represent'
do
create_list
(
:ci_pipeline
,
2
)
subject
{
serializer
.
represent
(
pipeline
)
}
end
let
(
:user
)
{
create
(
:user
)
}
it
'serializers the pipeline object'
do
expect
(
subject
.
as_json
).
to
include
:id
# TODO add some tests here.
end
end
end
end
spec/serializers/status_entity_spec.rb
View file @
ccea4727
require
'spec_helper'
require
'spec_helper'
describe
StatusEntity
do
describe
StatusEntity
do
let
(
:entity
)
do
let
(
:entity
)
{
described_class
.
new
(
status
)
}
described_class
.
new
(
status
)
end
let
(
:status
)
do
# TODO, add statuses factory
let
(
:status
)
do
Gitlab
::
Ci
::
Status
::
Success
.
new
(
double
(
'object'
))
Gitlab
::
Ci
::
Status
::
Success
.
new
(
double
(
'object'
)
,
double
(
'user'
)
)
end
end
before
do
before
do
...
@@ -17,7 +15,7 @@ describe StatusEntity do
...
@@ -17,7 +15,7 @@ describe StatusEntity do
subject
{
entity
.
as_json
}
subject
{
entity
.
as_json
}
it
'contains status details'
do
it
'contains status details'
do
expect
(
subject
).
to
include
:text
,
:icon
,
:label
,
:title
expect
(
subject
).
to
include
:text
,
:icon
,
:label
expect
(
subject
).
to
include
:has_details
expect
(
subject
).
to
include
:has_details
expect
(
subject
).
to
include
:details_path
expect
(
subject
).
to
include
:details_path
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