blob: 3698b0f17eb495cc69b6461a5e6e035a6866d011 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# frozen_string_literal: true
FactoryBot.define do
factory :ci_reports_sbom_report, class: '::Gitlab::Ci::Reports::Sbom::Report' do
transient do
sbom_attributes do
{
bom_format: 'CycloneDX',
spec_version: '1.4',
serial_number: "urn:uuid:aec33827-20ae-40d0-ae83-18ee846364d2",
version: 1
}
end
num_components { 5 }
components { build_list :ci_reports_sbom_component, num_components }
source { association :ci_reports_sbom_source }
end
trait :invalid do
after(:build) do |report, options|
report.add_error('This report is invalid because it contains errors.')
end
end
trait(:with_metadata) do
transient do
metadata { association(:ci_reports_sbom_metadata) }
end
after(:build) do |report, options|
report.metadata = options.metadata
end
end
after(:build) do |report, options|
options.components.each { |component| report.add_component(component) } if options.components
report.set_source(options.source)
end
skip_create
end
end
|