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
651eccda
Commit
651eccda
authored
Nov 29, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose timestamp in build entity used by serializer
parent
b8f9949a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
9 deletions
+19
-9
app/serializers/build_entity.rb
app/serializers/build_entity.rb
+3
-0
spec/serializers/build_entity_spec.rb
spec/serializers/build_entity_spec.rb
+16
-9
No files found.
app/serializers/build_entity.rb
View file @
651eccda
...
@@ -16,6 +16,9 @@ class BuildEntity < Grape::Entity
...
@@ -16,6 +16,9 @@ class BuildEntity < Grape::Entity
path_to
(
:play_namespace_project_build
,
build
)
path_to
(
:play_namespace_project_build
,
build
)
end
end
expose
:created_at
expose
:updated_at
private
private
def
path_to
(
route
,
build
)
def
path_to
(
route
,
build
)
...
...
spec/serializers/build_entity_spec.rb
View file @
651eccda
require
'spec_helper'
require
'spec_helper'
describe
BuildEntity
do
describe
BuildEntity
do
let
(
:build
)
{
create
(
:ci_build
)
}
let
(
:entity
)
do
let
(
:entity
)
do
described_class
.
new
(
build
,
request:
double
)
described_class
.
new
(
build
,
request:
double
)
end
end
subject
{
entity
.
as_json
}
subject
{
entity
.
as_json
}
context
'when build is a regular job'
do
it
'contains paths to build page and retry action'
do
let
(
:build
)
{
create
(
:ci_build
)
}
expect
(
subject
).
to
include
(
:build_path
,
:retry_path
)
end
it
'contains paths to build page and retry action'
do
it
'does not contain sensitive information'
do
expect
(
subject
).
to
include
(
:build_path
,
:retry_path
)
expect
(
subject
).
not_to
include
(
/token/
)
expect
(
subject
).
not_to
include
(
:play_path
)
expect
(
subject
).
not_to
include
(
/variables/
)
end
end
it
'contains timestamps'
do
expect
(
subject
).
to
include
(
:created_at
,
:updated_at
)
end
it
'does not contain sensitive information
'
do
context
'when build is a regular job
'
do
expect
(
subject
).
not_to
include
(
/token/
)
it
'does not contain path to play action'
do
expect
(
subject
).
not_to
include
(
/variables/
)
expect
(
subject
).
not_to
include
(
:play_path
)
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