Commit 8b2546f1 authored by Alan (Maciej) Paruszewski's avatar Alan (Maciej) Paruszewski Committed by Stan Hu

Change default Vendor name to GitLab when not defined in the report

parent 3ecbbe3a
---
title: Change default vendor name to GitLab if not defined in the security schema
merge_request: 36519
author:
type: fixed
......@@ -18,13 +18,11 @@ module Gitlab
end
def to_hash
%i[
external_id
name
vendor
].each_with_object({}) do |key, hash|
hash[key] = public_send(key).to_s # rubocop:disable GitlabSecurity/PublicSend
end
{
external_id: external_id.to_s,
name: name.to_s,
vendor: vendor.presence
}.compact
end
def ==(other)
......
......@@ -61,6 +61,17 @@ RSpec.describe Gitlab::Ci::Reports::Security::Scanner do
vendor: scanner.vendor
})
end
context 'when vendor is not defined' do
let(:scanner) { create(:ci_reports_security_scanner, vendor: nil) }
it 'returns expected hash' do
is_expected.to eq({
external_id: scanner.external_id,
name: scanner.name
})
end
end
end
describe '#==' do
......
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