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
2bb49182
Commit
2bb49182
authored
Dec 21, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing specs for CI pipeline stage entity
[ci skip]
parent
e072a274
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
0 deletions
+41
-0
app/serializers/stage_entity.rb
app/serializers/stage_entity.rb
+1
-0
spec/serializers/stage_entity_spec.rb
spec/serializers/stage_entity_spec.rb
+40
-0
No files found.
app/serializers/stage_entity.rb
View file @
2bb49182
...
...
@@ -2,6 +2,7 @@ class StageEntity < Grape::Entity
include
RequestAwareEntity
expose
:name
expose
:status
do
|
stage
,
options
|
StatusEntity
.
represent
(
stage
.
detailed_status
(
request
.
user
),
...
...
spec/serializers/stage_entity_spec.rb
0 → 100644
View file @
2bb49182
require
'spec_helper'
describe
StageEntity
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
)
}
let
(
:request
)
{
double
(
'request'
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:entity
)
do
described_class
.
new
(
stage
,
request:
request
)
end
let
(
:stage
)
do
build
(
:ci_stage
,
pipeline:
pipeline
,
name:
'test'
)
end
before
do
allow
(
request
).
to
receive
(
:user
).
and_return
(
user
)
end
describe
'#as_json'
do
subject
{
entity
.
as_json
}
it
'contains relevant fields'
do
expect
(
subject
).
to
include
:name
,
:status
,
:path
end
it
'contains detailed status'
do
expect
(
subject
[
:status
]).
to
include
:text
,
:label
,
:group
,
:icon
end
it
'contains valid name'
do
expect
(
subject
[
:name
]).
to
eq
'test'
end
it
'contains path to the stage'
do
expect
(
subject
[
:path
])
.
to
include
"pipelines/
#{
pipeline
.
id
}
#
#{
stage
.
name
}
"
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