Fixes spec failures due to not returning metrics for MRs other than closed/merged
This commit is contained in:
parent
bf8c20729b
commit
feee48a4cf
3 changed files with 9 additions and 2 deletions
|
@ -125,6 +125,10 @@ export default class MergeRequestStore {
|
|||
}
|
||||
|
||||
static buildMetrics(metrics) {
|
||||
if (!metrics) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return {
|
||||
mergedBy: MergeRequestStore.formatUserObject(metrics.merged_by),
|
||||
closedBy: MergeRequestStore.formatUserObject(metrics.closed_by),
|
||||
|
|
|
@ -32,8 +32,10 @@
|
|||
"target_branch": { "type": "string" },
|
||||
"target_project_id": { "type": "integer" },
|
||||
"metrics": {
|
||||
"type": "object",
|
||||
"$ref": "merge_request_metrics.json"
|
||||
"oneOf": [
|
||||
{ "type": "null" },
|
||||
{ "$ref": "merge_request_metrics.json" }
|
||||
]
|
||||
},
|
||||
"author": { "type": ["object", "null"] },
|
||||
"merge_user": { "type": ["object", "null"] },
|
||||
|
|
|
@ -72,6 +72,7 @@ describe MergeRequestWidgetEntity do
|
|||
|
||||
context 'when metrics does not exists' do
|
||||
before do
|
||||
resource.mark_as_merged!
|
||||
resource.metrics.destroy!
|
||||
resource.reload
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue