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
Boxiang Sun
gitlab-ce
Commits
d549a965
Commit
d549a965
authored
Dec 21, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing specs for new pipeline related entities
[ci skip]
parent
c8b16068
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
8 deletions
+52
-8
app/serializers/pipeline_action_entity.rb
app/serializers/pipeline_action_entity.rb
+1
-1
app/serializers/pipeline_artifact_entity.rb
app/serializers/pipeline_artifact_entity.rb
+1
-1
app/serializers/status_entity.rb
app/serializers/status_entity.rb
+1
-1
spec/serializers/pipeline_action_entity_spec.rb
spec/serializers/pipeline_action_entity_spec.rb
+21
-0
spec/serializers/pipeline_artifact_entity_spec.rb
spec/serializers/pipeline_artifact_entity_spec.rb
+22
-0
spec/serializers/status_entity_spec.rb
spec/serializers/status_entity_spec.rb
+6
-5
No files found.
app/serializers/pipeline_action_entity.rb
View file @
d549a965
...
@@ -5,7 +5,7 @@ class PipelineActionEntity < Grape::Entity
...
@@ -5,7 +5,7 @@ class PipelineActionEntity < Grape::Entity
build
.
name
.
humanize
build
.
name
.
humanize
end
end
expose
:
url
do
|
build
|
expose
:
path
do
|
build
|
play_namespace_project_build_path
(
play_namespace_project_build_path
(
build
.
project
.
namespace
,
build
.
project
.
namespace
,
build
.
project
,
build
.
project
,
...
...
app/serializers/pipeline_artifact_entity.rb
View file @
d549a965
...
@@ -5,7 +5,7 @@ class PipelineArtifactEntity < Grape::Entity
...
@@ -5,7 +5,7 @@ class PipelineArtifactEntity < Grape::Entity
build
.
name
build
.
name
end
end
expose
:
url
do
|
build
|
expose
:
path
do
|
build
|
download_namespace_project_build_artifacts_path
(
download_namespace_project_build_artifacts_path
(
build
.
project
.
namespace
,
build
.
project
.
namespace
,
build
.
project
,
build
.
project
,
...
...
app/serializers/status_entity.rb
View file @
d549a965
class
StatusEntity
<
Grape
::
Entity
class
StatusEntity
<
Grape
::
Entity
include
RequestAwareEntity
include
RequestAwareEntity
expose
:icon
,
:text
,
:label
expose
:icon
,
:text
,
:label
,
:group
expose
:has_details?
,
as: :has_details
expose
:has_details?
,
as: :has_details
expose
:details_path
expose
:details_path
...
...
spec/serializers/pipeline_action_entity_spec.rb
0 → 100644
View file @
d549a965
require
'spec_helper'
describe
PipelineActionEntity
do
let
(
:build
)
{
create
(
:ci_build
,
name:
'test_build'
)
}
let
(
:entity
)
do
described_class
.
new
(
build
,
request:
double
)
end
describe
'#as_json'
do
subject
{
entity
.
as_json
}
it
'contains humanized build name'
do
expect
(
subject
[
:name
]).
to
eq
'Test build'
end
it
'contains path to the action play'
do
expect
(
subject
[
:path
]).
to
include
"builds/
#{
build
.
id
}
/play"
end
end
end
spec/serializers/pipeline_artifact_entity_spec.rb
0 → 100644
View file @
d549a965
require
'spec_helper'
describe
PipelineArtifactEntity
do
let
(
:build
)
{
create
(
:ci_build
,
name:
'test:build'
)
}
let
(
:entity
)
do
described_class
.
new
(
build
,
request:
double
)
end
describe
'#as_json'
do
subject
{
entity
.
as_json
}
it
'contains build name'
do
expect
(
subject
[
:name
]).
to
eq
'test:build'
end
it
'contains path to the artifacts'
do
expect
(
subject
[
:path
])
.
to
include
"builds/
#{
build
.
id
}
/artifacts/download"
end
end
end
spec/serializers/status_entity_spec.rb
View file @
d549a965
...
@@ -12,11 +12,12 @@ describe StatusEntity do
...
@@ -12,11 +12,12 @@ describe StatusEntity do
allow
(
status
).
to
receive
(
:details_path
).
and_return
(
'some/path'
)
allow
(
status
).
to
receive
(
:details_path
).
and_return
(
'some/path'
)
end
end
subject
{
entity
.
as_json
}
describe
'#as_json'
do
subject
{
entity
.
as_json
}
it
'contains status details'
do
it
'contains status details'
do
expect
(
subject
).
to
include
:text
,
:icon
,
:label
expect
(
subject
).
to
include
:text
,
:icon
,
:label
,
:group
expect
(
subject
).
to
include
:has_details
expect
(
subject
).
to
include
:has_details
,
:details_path
e
xpect
(
subject
).
to
include
:details_path
e
nd
end
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