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
Jérome Perrin
gitlab-ce
Commits
a29ba51e
Commit
a29ba51e
authored
Jun 02, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix test failures
parent
b2f997e4
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
9 deletions
+14
-9
app/serializers/build_details_entity.rb
app/serializers/build_details_entity.rb
+9
-4
spec/controllers/projects/jobs_controller_spec.rb
spec/controllers/projects/jobs_controller_spec.rb
+2
-2
spec/serializers/build_details_entity_spec.rb
spec/serializers/build_details_entity_spec.rb
+1
-1
spec/serializers/build_entity_spec.rb
spec/serializers/build_entity_spec.rb
+2
-2
No files found.
app/serializers/build_details_entity.rb
View file @
a29ba51e
...
@@ -23,10 +23,8 @@ class BuildDetailsEntity < BuildEntity
...
@@ -23,10 +23,8 @@ class BuildDetailsEntity < BuildEntity
end
end
end
end
expose
:build_failed_options
do
expose
:new_issue_path
,
if:
->
(
*
)
{
can?
(
request
.
current_user
,
:create_issue
,
project
)
&&
build
.
failed?
}
do
|
build
|
expose
:new_issue_path
,
if:
->
(
*
)
{
can?
(
request
.
current_user
,
:create_issue
,
project
)
}
do
|
build
|
new_namespace_project_issue_path
(
project
.
namespace
,
project
,
issue:
build_failed_issue_options
)
new_namespace_project_issue_path
(
project
.
namespace
,
project
)
end
end
end
expose
:raw_path
do
|
build
|
expose
:raw_path
do
|
build
|
...
@@ -35,6 +33,13 @@ class BuildDetailsEntity < BuildEntity
...
@@ -35,6 +33,13 @@ class BuildDetailsEntity < BuildEntity
private
private
def
build_failed_issue_options
{
title:
"Build Failed #
#{
build
.
id
}
"
,
description:
namespace_project_job_url
(
project
.
namespace
,
project
,
build
)
}
end
def
current_user
def
current_user
request
.
current_user
request
.
current_user
end
end
...
...
spec/controllers/projects/jobs_controller_spec.rb
View file @
a29ba51e
...
@@ -142,8 +142,8 @@ describe Projects::JobsController do
...
@@ -142,8 +142,8 @@ describe Projects::JobsController do
expect
(
response
).
to
have_http_status
(
:ok
)
expect
(
response
).
to
have_http_status
(
:ok
)
expect
(
json_response
[
'raw_path'
]).
to
match
(
/builds\/\d+\/raw\z/
)
expect
(
json_response
[
'raw_path'
]).
to
match
(
/builds\/\d+\/raw\z/
)
expect
(
json_response
.
dig
(
'merge_request'
,
'path'
)).
to
match
(
/merge_requests\/\d+\z/
)
expect
(
json_response
.
dig
(
'merge_request'
,
'path'
)).
to
match
(
/merge_requests\/\d+\z/
)
expect
(
json_response
[
'
build_failed_options'
][
'
new_issue_path'
])
expect
(
json_response
[
'new_issue_path'
])
.
to
end_with
(
'/issues/new'
)
.
to
include
(
'/issues/new'
)
end
end
end
end
...
...
spec/serializers/build_details_entity_spec.rb
View file @
a29ba51e
...
@@ -31,7 +31,7 @@ describe BuildDetailsEntity do
...
@@ -31,7 +31,7 @@ describe BuildDetailsEntity do
expect
(
subject
).
to
include
(
:coverage
,
:erased_at
,
:duration
)
expect
(
subject
).
to
include
(
:coverage
,
:erased_at
,
:duration
)
expect
(
subject
).
to
include
(
:artifacts
,
:runner
,
:pipeline
)
expect
(
subject
).
to
include
(
:artifacts
,
:runner
,
:pipeline
)
expect
(
subject
).
to
include
(
:raw_path
,
:merge_request
)
expect
(
subject
).
to
include
(
:raw_path
,
:merge_request
)
expect
(
subject
[
:build_failed_options
]
).
to
include
(
:new_issue_path
)
expect
(
subject
).
to
include
(
:new_issue_path
)
end
end
it
'exposes details of the merge request'
do
it
'exposes details of the merge request'
do
...
...
spec/serializers/build_entity_spec.rb
View file @
a29ba51e
...
@@ -17,8 +17,8 @@ describe BuildEntity do
...
@@ -17,8 +17,8 @@ describe BuildEntity do
subject
{
entity
.
as_json
}
subject
{
entity
.
as_json
}
it
'contains paths to build page and retry action'
do
it
'contains paths to build page and retry action'
do
expect
(
subject
).
to
include
(
:build_path
,
:
build_failed_options
)
expect
(
subject
).
to
include
(
:build_path
,
:
retry_path
)
expect
(
subject
.
dig
(
:build_failed_options
,
:retry_path
)
).
not_to
be_nil
expect
(
subject
[
:retry_path
]
).
not_to
be_nil
end
end
it
'does not contain sensitive information'
do
it
'does not contain sensitive information'
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