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
e8eeee34
Commit
e8eeee34
authored
Oct 07, 2020
by
drew cimino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose merge_base_path on MR WidgetEntity
parent
d7b3f6e8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
5 deletions
+17
-5
app/serializers/merge_request_widget_entity.rb
app/serializers/merge_request_widget_entity.rb
+9
-0
spec/serializers/merge_request_widget_entity_spec.rb
spec/serializers/merge_request_widget_entity_spec.rb
+8
-5
No files found.
app/serializers/merge_request_widget_entity.rb
View file @
e8eeee34
...
...
@@ -122,6 +122,10 @@ class MergeRequestWidgetEntity < Grape::Entity
expose
:base_path
do
|
merge_request
|
base_pipeline_downloadable_path_for_report_type
(
:codequality
)
end
expose
:merge_base_path
do
|
merge_request
|
merge_target_pipeline_downloadable_path_for_report_type
(
:codequality
)
end
end
expose
:security_reports_docs_path
do
|
merge_request
|
...
...
@@ -156,6 +160,11 @@ class MergeRequestWidgetEntity < Grape::Entity
object
.
base_pipeline
&
.
present
(
current_user:
current_user
)
&
.
downloadable_path_for_report_type
(
file_type
)
end
def
merge_target_pipeline_downloadable_path_for_report_type
(
file_type
)
object
.
merge_base_pipeline
&
.
present
(
current_user:
current_user
)
&
.
downloadable_path_for_report_type
(
file_type
)
end
end
MergeRequestWidgetEntity
.
prepend_if_ee
(
'EE::MergeRequestWidgetEntity'
)
spec/serializers/merge_request_widget_entity_spec.rb
View file @
e8eeee34
...
...
@@ -92,21 +92,24 @@ RSpec.describe MergeRequestWidgetEntity do
project
.
add_developer
(
user
)
allow
(
resource
).
to
receive_messages
(
merge_base_pipeline:
pipeline
,
base_pipeline:
pipeline
,
head_pipeline:
pipeline
)
end
context
"with report artifacts"
do
context
'with report artifacts'
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
:with_codequality_report
,
project:
project
)
}
it
"has data entry"
do
expect
(
subject
).
to
include
(
:codeclimate
)
it
'has entries for 3 reference artifacts'
do
expect
(
subject
[
:codeclimate
][
:merge_base_path
]).
to
be_present
expect
(
subject
[
:codeclimate
][
:base_path
]).
to
be_present
expect
(
subject
[
:codeclimate
][
:head_path
]).
to
be_present
end
end
context
"without artifacts"
do
it
"does not have data entry"
do
context
'without artifacts'
do
it
'does not have data entry'
do
expect
(
subject
).
not_to
include
(
:codeclimate
)
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