Commit 2234a465 authored by Bob Whitmer's avatar Bob Whitmer Committed by Rémy Coutable

Fix incorrect render in JUnit merge UI with null or blank name value

Previously test cases in merges with no name associated would not
render a clickable link. This change makes sure that if no field is
present, `(No name)` will render to provide a clickable link to inspect
the test.

Changelog: fixed
Authored-by: default avatarBob Whitmer <rjwhitmercc@gmail.com>
Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent e5435114
......@@ -4,7 +4,7 @@ class TestCaseEntity < Grape::Entity
include API::Helpers::RelatedResourcesHelpers
expose :status
expose :name
expose :name, default: "(No name)"
expose :classname
expose :file
expose :execution_time
......
......@@ -41,6 +41,18 @@ RSpec.describe TestCaseEntity do
end
end
context 'when no test name is entered' do
let(:test_case) { build(:report_test_case, name: "") }
it 'contains correct test case details' do
expect(subject[:status]).to eq('success')
expect(subject[:name]).to eq('(No name)')
expect(subject[:classname]).to eq('trace')
expect(subject[:file]).to eq('spec/trace_spec.rb')
expect(subject[:execution_time]).to eq(1.23)
end
end
context 'when attachment is present' do
let(:test_case) { build(:report_test_case, :failed_with_attachment, job: job) }
......
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