debian-mirror-gitlab/spec/factories/ci/reports/sbom/components.rb
2023-01-12 18:35:48 +00:00

33 lines
641 B
Ruby

# frozen_string_literal: true
FactoryBot.define do
factory :ci_reports_sbom_component, class: '::Gitlab::Ci::Reports::Sbom::Component' do
type { "library" }
sequence(:name) { |n| "component-#{n}" }
sequence(:version) { |n| "v0.0.#{n}" }
transient do
purl_type { 'npm' }
end
purl do
::Sbom::PackageUrl.new(
type: purl_type,
name: name,
version: version
).to_s
end
skip_create
initialize_with do
::Gitlab::Ci::Reports::Sbom::Component.new(
type: type,
name: name,
purl: purl,
version: version
)
end
end
end