Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/ci/reports/sbom/report_spec.rb')
-rw-r--r--spec/lib/gitlab/ci/reports/sbom/report_spec.rb26
1 files changed, 4 insertions, 22 deletions
diff --git a/spec/lib/gitlab/ci/reports/sbom/report_spec.rb b/spec/lib/gitlab/ci/reports/sbom/report_spec.rb
index d7a285ab13c..6ffa93e5fc8 100644
--- a/spec/lib/gitlab/ci/reports/sbom/report_spec.rb
+++ b/spec/lib/gitlab/ci/reports/sbom/report_spec.rb
@@ -15,40 +15,22 @@ RSpec.describe Gitlab::Ci::Reports::Sbom::Report do
end
describe '#set_source' do
- let_it_be(:source) do
- {
- 'type' => :dependency_scanning,
- 'data' => {
- 'input_file' => { 'path' => 'package-lock.json' },
- 'source_file' => { 'path' => 'package.json' },
- 'package_manager' => { 'name' => 'npm' },
- 'language' => { 'name' => 'JavaScript' }
- },
- 'fingerprint' => 'c01df1dc736c1148717e053edbde56cb3a55d3e31f87cea955945b6f67c17d42'
- }
- end
+ let_it_be(:source) { create(:ci_reports_sbom_source) }
it 'stores the source' do
report.set_source(source)
- expect(report.source).to be_a(Gitlab::Ci::Reports::Sbom::Source)
+ expect(report.source).to eq(source)
end
end
describe '#add_component' do
- let_it_be(:components) do
- [
- { 'type' => 'library', 'name' => 'component1', 'version' => 'v0.0.1' },
- { 'type' => 'library', 'name' => 'component2', 'version' => 'v0.0.2' },
- { 'type' => 'library', 'name' => 'component2' }
- ]
- end
+ let_it_be(:components) { create_list(:ci_reports_sbom_component, 3) }
it 'appends components to a list' do
components.each { |component| report.add_component(component) }
- expect(report.components.size).to eq(3)
- expect(report.components).to all(be_a(Gitlab::Ci::Reports::Sbom::Component))
+ expect(report.components).to match_array(components)
end
end
end