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
54ee0df7
Commit
54ee0df7
authored
Nov 17, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not use absolute URLS in entities use relative
parent
73a5f331
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
24 additions
and
24 deletions
+24
-24
app/serializers/build_entity.rb
app/serializers/build_entity.rb
+8
-8
app/serializers/commit_entity.rb
app/serializers/commit_entity.rb
+2
-2
app/serializers/deployment_entity.rb
app/serializers/deployment_entity.rb
+2
-2
app/serializers/environment_entity.rb
app/serializers/environment_entity.rb
+2
-2
spec/serializers/build_entity_spec.rb
spec/serializers/build_entity_spec.rb
+5
-5
spec/serializers/commit_entity_spec.rb
spec/serializers/commit_entity_spec.rb
+2
-2
spec/serializers/deployment_entity_spec.rb
spec/serializers/deployment_entity_spec.rb
+1
-1
spec/serializers/environment_entity_spec.rb
spec/serializers/environment_entity_spec.rb
+1
-1
spec/serializers/environment_serializer_spec.rb
spec/serializers/environment_serializer_spec.rb
+1
-1
No files found.
app/serializers/build_entity.rb
View file @
54ee0df7
...
...
@@ -4,21 +4,21 @@ class BuildEntity < Grape::Entity
expose
:id
expose
:name
expose
:build_
url
do
|
build
|
url
_to
(
:namespace_project_build
,
build
)
expose
:build_
path
do
|
build
|
path
_to
(
:namespace_project_build
,
build
)
end
expose
:retry_
url
do
|
build
|
url
_to
(
:retry_namespace_project_build
,
build
)
expose
:retry_
path
do
|
build
|
path
_to
(
:retry_namespace_project_build
,
build
)
end
expose
:play_
url
,
if:
->
(
build
,
_
)
{
build
.
manual?
}
do
|
build
|
url
_to
(
:play_namespace_project_build
,
build
)
expose
:play_
path
,
if:
->
(
build
,
_
)
{
build
.
manual?
}
do
|
build
|
path
_to
(
:play_namespace_project_build
,
build
)
end
private
def
url
_to
(
route
,
build
)
send
(
"
#{
route
}
_
url
"
,
build
.
project
.
namespace
,
build
.
project
,
build
)
def
path
_to
(
route
,
build
)
send
(
"
#{
route
}
_
path
"
,
build
.
project
.
namespace
,
build
.
project
,
build
)
end
end
app/serializers/commit_entity.rb
View file @
54ee0df7
...
...
@@ -3,8 +3,8 @@ class CommitEntity < API::Entities::RepoCommit
expose
:author
,
using:
UserEntity
expose
:commit_
url
do
|
commit
|
namespace_project_tree_
url
(
expose
:commit_
path
do
|
commit
|
namespace_project_tree_
path
(
request
.
project
.
namespace
,
request
.
project
,
id:
commit
.
id
)
...
...
app/serializers/deployment_entity.rb
View file @
54ee0df7
...
...
@@ -10,8 +10,8 @@ class DeploymentEntity < Grape::Entity
deployment
.
ref
end
expose
:ref_
url
do
|
deployment
|
namespace_project_tree_
url
(
expose
:ref_
path
do
|
deployment
|
namespace_project_tree_
path
(
deployment
.
project
.
namespace
,
deployment
.
project
,
id:
deployment
.
ref
)
...
...
app/serializers/environment_entity.rb
View file @
54ee0df7
...
...
@@ -9,8 +9,8 @@ class EnvironmentEntity < Grape::Entity
expose
:last_deployment
,
using:
DeploymentEntity
expose
:stoppable?
expose
:environment_
url
do
|
environment
|
namespace_project_environment_
url
(
expose
:environment_
path
do
|
environment
|
namespace_project_environment_
path
(
environment
.
project
.
namespace
,
environment
.
project
,
environment
)
...
...
spec/serializers/build_entity_spec.rb
View file @
54ee0df7
...
...
@@ -10,9 +10,9 @@ describe BuildEntity do
context
'when build is a regular job'
do
let
(
:build
)
{
create
(
:ci_build
)
}
it
'contains
url
to build page and retry action'
do
expect
(
subject
).
to
include
(
:build_
url
,
:retry_url
)
expect
(
subject
).
not_to
include
(
:play_
url
)
it
'contains
paths
to build page and retry action'
do
expect
(
subject
).
to
include
(
:build_
path
,
:retry_path
)
expect
(
subject
).
not_to
include
(
:play_
path
)
end
it
'does not contain sensitive information'
do
...
...
@@ -24,8 +24,8 @@ describe BuildEntity do
context
'when build is a manual action'
do
let
(
:build
)
{
create
(
:ci_build
,
:manual
)
}
it
'contains
url
to play action'
do
expect
(
subject
).
to
include
(
:play_
url
)
it
'contains
path
to play action'
do
expect
(
subject
).
to
include
(
:play_
path
)
end
end
end
spec/serializers/commit_entity_spec.rb
View file @
54ee0df7
...
...
@@ -31,8 +31,8 @@ describe CommitEntity do
end
end
it
'contains
commit URL
'
do
expect
(
subject
).
to
include
(
:commit_
url
)
it
'contains
path to commit
'
do
expect
(
subject
).
to
include
(
:commit_
path
)
end
it
'needs to receive project in the request'
do
...
...
spec/serializers/deployment_entity_spec.rb
View file @
54ee0df7
...
...
@@ -15,6 +15,6 @@ describe DeploymentEntity do
it
'exposes nested information about branch'
do
expect
(
subject
[
:ref
][
:name
]).
to
eq
'master'
expect
(
subject
[
:ref
][
:ref_
url
]).
not_to
be_empty
expect
(
subject
[
:ref
][
:ref_
path
]).
not_to
be_empty
end
end
spec/serializers/environment_entity_spec.rb
View file @
54ee0df7
...
...
@@ -13,6 +13,6 @@ describe EnvironmentEntity do
end
it
'exposes core elements of environment'
do
expect
(
subject
).
to
include
(
:id
,
:name
,
:state
,
:environment_
url
)
expect
(
subject
).
to
include
(
:id
,
:name
,
:state
,
:environment_
path
)
end
end
spec/serializers/environment_serializer_spec.rb
View file @
54ee0df7
...
...
@@ -33,7 +33,7 @@ describe EnvironmentSerializer do
it
'contains important elements of environment'
do
expect
(
json
)
.
to
include
(
:name
,
:external_url
,
:environment_
url
,
:last_deployment
)
.
to
include
(
:name
,
:external_url
,
:environment_
path
,
:last_deployment
)
end
it
'contains relevant information about last deployment'
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