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
a2c1178c
Commit
a2c1178c
authored
Nov 04, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose commit author if author exists
parent
f203ca5c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
app/serializers/commit_entity.rb
app/serializers/commit_entity.rb
+2
-0
spec/serializers/environment_serializer_spec.rb
spec/serializers/environment_serializer_spec.rb
+6
-5
No files found.
app/serializers/commit_entity.rb
View file @
a2c1178c
class
CommitEntity
<
API
::
Entities
::
RepoCommit
include
RequestAwareEntity
expose
:author
,
using:
API
::
Entities
::
UserBasic
expose
:commit_url
do
|
commit
|
@urls
.
namespace_project_tree_url
(
@request
.
project
.
namespace
,
...
...
spec/serializers/environment_serializer_spec.rb
View file @
a2c1178c
...
...
@@ -7,6 +7,7 @@ describe EnvironmentSerializer do
.
represent
(
resource
)
end
let
(
:json
)
{
serializer
.
as_json
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
...
...
@@ -27,16 +28,16 @@ describe EnvironmentSerializer do
let
(
:resource
)
{
deployment
.
environment
}
it
'it generates payload for single object'
do
expect
(
serializer
.
as_
json
).
to
be_an_instance_of
Hash
expect
(
json
).
to
be_an_instance_of
Hash
end
it
'contains important elements of environment'
do
expect
(
serializer
.
as_
json
)
expect
(
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
)
last_deployment
=
json
.
fetch
(
:last_deployment
)
expect
(
last_deployment
)
.
to
include
(
:ref
,
:user
,
:commit
,
:deployable
,
:manual_actions
)
...
...
@@ -48,12 +49,12 @@ describe EnvironmentSerializer do
let
(
:resource
)
{
create_list
(
:environment
,
2
)
}
it
'contains important elements of environment'
do
expect
(
serializer
.
as_
json
.
first
)
expect
(
json
.
first
)
.
to
include
(
:last_deployment
,
:name
,
:external_url
)
end
it
'generates payload for collection'
do
expect
(
serializer
.
as_
json
).
to
be_an_instance_of
Array
expect
(
json
).
to
be_an_instance_of
Array
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