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
c3dae798
Commit
c3dae798
authored
Nov 03, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend tests for environments serializer
parent
7dd6485a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
+16
-7
app/serializers/environment_entity.rb
app/serializers/environment_entity.rb
+1
-1
spec/serializers/environment_serializer_spec.rb
spec/serializers/environment_serializer_spec.rb
+15
-6
No files found.
app/serializers/environment_entity.rb
View file @
c3dae798
...
@@ -10,7 +10,7 @@ class EnvironmentEntity < Grape::Entity
...
@@ -10,7 +10,7 @@ class EnvironmentEntity < Grape::Entity
expose
:last_deployment
,
using:
DeploymentEntity
expose
:last_deployment
,
using:
DeploymentEntity
expose
:stoppable?
expose
:stoppable?
expose
:environmenturl
do
|
environment
|
expose
:environment
_
url
do
|
environment
|
@urls
.
namespace_project_environment_url
(
@urls
.
namespace_project_environment_url
(
environment
.
project
.
namespace
,
environment
.
project
.
namespace
,
environment
.
project
,
environment
.
project
,
...
...
spec/serializers/environment_serializer_spec.rb
View file @
c3dae798
...
@@ -24,21 +24,30 @@ describe EnvironmentSerializer do
...
@@ -24,21 +24,30 @@ describe EnvironmentSerializer do
let
(
:project
)
{
deployment
.
project
}
let
(
:project
)
{
deployment
.
project
}
let
(
:resource
)
{
deployment
.
environment
}
let
(
:resource
)
{
deployment
.
environment
}
it
'shows json'
do
pp
serializer
.
as_json
end
it
'it generates payload for single object'
do
it
'it generates payload for single object'
do
expect
(
serializer
.
as_json
).
to
be_an_instance_of
Hash
expect
(
serializer
.
as_json
).
to
be_an_instance_of
Hash
end
end
it
'contains important elements of environment'
do
expect
(
serializer
.
as_json
)
.
to
include
(
:name
,
:external_url
,
:environment_url
,
:last_deployment
)
end
it
'contains relevant information about last deployment'
do
last_deployment
=
serializer
.
as_json
.
fetch
(
:last_deployment
)
expect
(
last_deployment
)
.
to
include
(
:ref
,
:user
,
:commit
,
:deployable
,
:manual_actions
)
end
end
end
context
'when there is a collection of objects provided'
do
context
'when there is a collection of objects provided'
do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:resource
)
{
create_list
(
:environment
,
2
)
}
let
(
:resource
)
{
create_list
(
:environment
,
2
)
}
it
'shows json'
do
it
'contains important elements of environment'
do
puts
serializer
.
as_json
expect
(
serializer
.
as_json
.
first
)
.
to
include
(
:last_deployment
,
:name
,
:external_url
)
end
end
it
'generates payload for collection'
do
it
'generates payload for collection'
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