提交 feee48a4 编写于 作者: O Oswaldo Ferreira

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

上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册