Commit b7365c90 authored by Imre Farkas's avatar Imre Farkas

Merge branch '209853-fix-blocking-mr-latest-closed-at' into 'master'

Fix displaying merge request dependencies with no metrics

See merge request gitlab-org/gitlab!49466
parents b6d8d327 85d2ac7d
......@@ -29,7 +29,7 @@ class BlockingMergeRequestEntity < Grape::Entity
expose :created_at
expose :merged_at
expose :closed_at do |blocking_mr|
blocking_mr.metrics.latest_closed_at
blocking_mr.metrics&.latest_closed_at
end
private
......
---
title: Fix displaying merge request dependencies with no metrics
merge_request: 49466
author:
type: fixed
......@@ -29,6 +29,12 @@ RSpec.describe BlockingMergeRequestEntity do
)
end
it 'serializes a blocking MR that lacks metrics' do
expect(merge_request).to receive(:metrics).and_return(nil)
expect(entity.as_json).to include(id: merge_request.id, closed_at: nil)
end
describe '#head_pipeline' do
subject { entity.as_json[:head_pipeline] }
......
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