Commit feee48a4 authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Fixes spec failures due to not returning metrics for MRs other than closed/merged

parent bf8c2072
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment