Commit 85d2ac7d authored by Nick Thomas's avatar Nick Thomas

Fix displaying blocking MRs with no metrics

Metrics may not exist for some older MRs, so we need to &.
parent 547ffaec
......@@ -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