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
e8f2daae
Commit
e8f2daae
authored
Apr 20, 2017
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup duplicates in deploymentEntityDetailed and add small spec tests
parent
44699461
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
24 deletions
+31
-24
app/serializers/deployment_entity_detailed.rb
app/serializers/deployment_entity_detailed.rb
+1
-14
spec/serializers/deployment_entity_detailed_spec.rb
spec/serializers/deployment_entity_detailed_spec.rb
+26
-0
spec/serializers/deployment_entity_spec.rb
spec/serializers/deployment_entity_spec.rb
+4
-10
No files found.
app/serializers/deployment_entity_detailed.rb
View file @
e8f2daae
class
DeploymentEntityDetailed
<
Grape
::
Entity
class
DeploymentEntityDetailed
<
DeploymentEntity
include
RequestAwareEntity
expose
:id
expose
:iid
expose
:sha
expose
:ref
do
expose
:ref
do
expose
:name
do
|
deployment
|
deployment
.
ref
end
expose
:ref_path
do
|
deployment
|
expose
:ref_path
do
|
deployment
|
namespace_project_tree_path
(
namespace_project_tree_path
(
deployment
.
project
.
namespace
,
deployment
.
project
.
namespace
,
...
@@ -18,9 +8,6 @@ class DeploymentEntityDetailed < Grape::Entity
...
@@ -18,9 +8,6 @@ class DeploymentEntityDetailed < Grape::Entity
end
end
end
end
expose
:created_at
expose
:tag
expose
:last?
expose
:user
,
using:
UserEntity
expose
:user
,
using:
UserEntity
expose
:commit
,
using:
CommitEntity
expose
:commit
,
using:
CommitEntity
expose
:deployable
,
using:
BuildEntity
expose
:deployable
,
using:
BuildEntity
...
...
spec/serializers/deployment_entity_detailed_spec.rb
0 → 100644
View file @
e8f2daae
require
'spec_helper'
describe
DeploymentEntityDetailed
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:request
)
{
double
(
'request'
)
}
let
(
:deployment
)
{
create
(
:deployment
)
}
let
(
:entity
)
{
described_class
.
new
(
deployment
,
request:
request
)
}
subject
{
entity
.
as_json
}
before
do
allow
(
request
).
to
receive
(
:user
).
and_return
(
user
)
end
it
'exposes internal deployment id'
do
expect
(
subject
).
to
include
(
:iid
)
end
it
'exposes nested information about branch'
do
expect
(
subject
[
:ref
][
:name
]).
to
eq
'master'
expect
(
subject
[
:ref
][
:ref_path
]).
not_to
be_empty
end
it
'exposes creation date'
do
expect
(
subject
).
to
include
(
:created_at
)
end
end
spec/serializers/deployment_entity_spec.rb
View file @
e8f2daae
require
'spec_helper'
require
'spec_helper'
describe
DeploymentEntity
Detailed
do
describe
DeploymentEntity
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:request
)
{
double
(
'request'
)
}
let
(
:request
)
{
double
(
'request'
)
}
let
(
:deployment
)
{
create
(
:deployment
)
}
let
(
:entity
)
{
described_class
.
new
(
deployment
,
request:
request
)
}
subject
{
entity
.
as_json
}
before
do
before
do
allow
(
request
).
to
receive
(
:user
).
and_return
(
user
)
allow
(
request
).
to
receive
(
:user
).
and_return
(
user
)
end
end
let
(
:entity
)
do
described_class
.
new
(
deployment
,
request:
request
)
end
let
(
:deployment
)
{
create
(
:deployment
)
}
subject
{
entity
.
as_json
}
it
'exposes internal deployment id'
do
it
'exposes internal deployment id'
do
expect
(
subject
).
to
include
(
:iid
)
expect
(
subject
).
to
include
(
:iid
)
end
end
it
'exposes nested information about branch'
do
it
'exposes nested information about branch'
do
expect
(
subject
[
:ref
][
:name
]).
to
eq
'master'
expect
(
subject
[
:ref
][
:name
]).
to
eq
'master'
expect
(
subject
[
:ref
][
:ref_path
]).
not_to
be_empty
end
end
it
'exposes creation date'
do
it
'exposes creation date'
do
...
...
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