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
62545ddb
Commit
62545ddb
authored
Oct 04, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add serializers tests
parent
07247601
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
0 deletions
+41
-0
spec/serializers/cluster_entity_spec.rb
spec/serializers/cluster_entity_spec.rb
+22
-0
spec/serializers/cluster_serializer_spec.rb
spec/serializers/cluster_serializer_spec.rb
+19
-0
No files found.
spec/serializers/cluster_entity_spec.rb
0 → 100644
View file @
62545ddb
require
'spec_helper'
describe
ClusterEntity
do
set
(
:cluster
)
{
create
(
:gcp_cluster
,
:errored
)
}
let
(
:request
)
{
double
(
'request'
)
}
let
(
:entity
)
do
described_class
.
new
(
cluster
)
end
describe
'#as_json'
do
subject
{
entity
.
as_json
}
it
'contains status'
do
expect
(
subject
[
:status
]).
to
eq
(
:errored
)
end
it
'contains status reason'
do
expect
(
subject
[
:status_reason
]).
to
eq
(
'general error'
)
end
end
end
spec/serializers/cluster_serializer_spec.rb
0 → 100644
View file @
62545ddb
require
'spec_helper'
describe
ClusterSerializer
do
let
(
:serializer
)
do
described_class
.
new
end
describe
'#represent_status'
do
subject
{
serializer
.
represent_status
(
resource
)
}
context
'when represents only status'
do
let
(
:resource
)
{
create
(
:gcp_cluster
,
:errored
)
}
it
'serializes only status'
do
expect
(
subject
.
keys
).
to
contain_exactly
(
:status
,
:status_reason
)
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