diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
commit | 6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch) | |
tree | dc4d20fe6064752c0bd323187252c77e0a89144b /spec/lib/gitlab/ci/reports | |
parent | 9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff) |
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'spec/lib/gitlab/ci/reports')
12 files changed, 29 insertions, 47 deletions
diff --git a/spec/lib/gitlab/ci/reports/accessibility_reports_comparer_spec.rb b/spec/lib/gitlab/ci/reports/accessibility_reports_comparer_spec.rb index ade0e36cf1e..ad8f1dc11f8 100644 --- a/spec/lib/gitlab/ci/reports/accessibility_reports_comparer_spec.rb +++ b/spec/lib/gitlab/ci/reports/accessibility_reports_comparer_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'spec_helper' +require 'fast_spec_helper' RSpec.describe Gitlab::Ci::Reports::AccessibilityReportsComparer do let(:comparer) { described_class.new(base_report, head_report) } diff --git a/spec/lib/gitlab/ci/reports/accessibility_reports_spec.rb b/spec/lib/gitlab/ci/reports/accessibility_reports_spec.rb index 8c35b2a34cf..af6844491ca 100644 --- a/spec/lib/gitlab/ci/reports/accessibility_reports_spec.rb +++ b/spec/lib/gitlab/ci/reports/accessibility_reports_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'spec_helper' +require 'fast_spec_helper' RSpec.describe Gitlab::Ci::Reports::AccessibilityReports do let(:accessibility_report) { described_class.new } diff --git a/spec/lib/gitlab/ci/reports/coverage_report_spec.rb b/spec/lib/gitlab/ci/reports/coverage_report_spec.rb index 53646f7dfc0..23361a0c768 100644 --- a/spec/lib/gitlab/ci/reports/coverage_report_spec.rb +++ b/spec/lib/gitlab/ci/reports/coverage_report_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'spec_helper' +require 'fast_spec_helper' RSpec.describe Gitlab::Ci::Reports::CoverageReport do let(:coverage_report) { described_class.new } diff --git a/spec/lib/gitlab/ci/reports/sbom/component_spec.rb b/spec/lib/gitlab/ci/reports/sbom/component_spec.rb index 672117c311f..06ea3433ef0 100644 --- a/spec/lib/gitlab/ci/reports/sbom/component_spec.rb +++ b/spec/lib/gitlab/ci/reports/sbom/component_spec.rb @@ -1,23 +1,23 @@ # frozen_string_literal: true -require 'spec_helper' +require 'fast_spec_helper' RSpec.describe Gitlab::Ci::Reports::Sbom::Component do let(:attributes) do { - 'type' => 'library', - 'name' => 'component-name', - 'version' => 'v0.0.1' + type: 'library', + name: 'component-name', + version: 'v0.0.1' } end - subject { described_class.new(attributes) } + subject { described_class.new(**attributes) } it 'has correct attributes' do expect(subject).to have_attributes( - component_type: 'library', - name: 'component-name', - version: 'v0.0.1' + component_type: attributes[:type], + name: attributes[:name], + version: attributes[:version] ) end end 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 diff --git a/spec/lib/gitlab/ci/reports/sbom/reports_spec.rb b/spec/lib/gitlab/ci/reports/sbom/reports_spec.rb index 97d8d7abb33..75ea91251eb 100644 --- a/spec/lib/gitlab/ci/reports/sbom/reports_spec.rb +++ b/spec/lib/gitlab/ci/reports/sbom/reports_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'spec_helper' +require 'fast_spec_helper' RSpec.describe Gitlab::Ci::Reports::Sbom::Reports do subject(:reports_list) { described_class.new } diff --git a/spec/lib/gitlab/ci/reports/sbom/source_spec.rb b/spec/lib/gitlab/ci/reports/sbom/source_spec.rb index 2d6434534a0..cb30bd721dd 100644 --- a/spec/lib/gitlab/ci/reports/sbom/source_spec.rb +++ b/spec/lib/gitlab/ci/reports/sbom/source_spec.rb @@ -1,29 +1,29 @@ # frozen_string_literal: true -require 'spec_helper' +require 'fast_spec_helper' RSpec.describe Gitlab::Ci::Reports::Sbom::Source do let(:attributes) do { - 'type' => :dependency_scanning, - 'data' => { + type: :dependency_scanning, + data: { 'category' => 'development', 'input_file' => { 'path' => 'package-lock.json' }, 'source_file' => { 'path' => 'package.json' }, 'package_manager' => { 'name' => 'npm' }, 'language' => { 'name' => 'JavaScript' } }, - 'fingerprint' => '4dbcb747e6f0fb3ed4f48d96b777f1d64acdf43e459fdfefad404e55c004a188' + fingerprint: '4dbcb747e6f0fb3ed4f48d96b777f1d64acdf43e459fdfefad404e55c004a188' } end - subject { described_class.new(attributes) } + subject { described_class.new(**attributes) } it 'has correct attributes' do expect(subject).to have_attributes( - source_type: attributes['type'], - data: attributes['data'], - fingerprint: attributes['fingerprint'] + source_type: attributes[:type], + data: attributes[:data], + fingerprint: attributes[:fingerprint] ) end end diff --git a/spec/lib/gitlab/ci/reports/security/flag_spec.rb b/spec/lib/gitlab/ci/reports/security/flag_spec.rb index d677425a8da..6ee074f7aeb 100644 --- a/spec/lib/gitlab/ci/reports/security/flag_spec.rb +++ b/spec/lib/gitlab/ci/reports/security/flag_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'spec_helper' +require 'fast_spec_helper' RSpec.describe Gitlab::Ci::Reports::Security::Flag do subject(:security_flag) { described_class.new(type: 'flagged-as-likely-false-positive', origin: 'post analyzer X', description: 'static string to sink') } diff --git a/spec/lib/gitlab/ci/reports/security/link_spec.rb b/spec/lib/gitlab/ci/reports/security/link_spec.rb index 7b55af27f4d..0e1cdc93f6c 100644 --- a/spec/lib/gitlab/ci/reports/security/link_spec.rb +++ b/spec/lib/gitlab/ci/reports/security/link_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'spec_helper' +require 'fast_spec_helper' RSpec.describe Gitlab::Ci::Reports::Security::Link do subject(:security_link) { described_class.new(name: 'CVE-2020-0202', url: 'https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-0202') } diff --git a/spec/lib/gitlab/ci/reports/security/scan_spec.rb b/spec/lib/gitlab/ci/reports/security/scan_spec.rb index b4968ff3a6e..23427e8608c 100644 --- a/spec/lib/gitlab/ci/reports/security/scan_spec.rb +++ b/spec/lib/gitlab/ci/reports/security/scan_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'spec_helper' +require 'fast_spec_helper' RSpec.describe Gitlab::Ci::Reports::Security::Scan do describe '#initialize' do diff --git a/spec/lib/gitlab/ci/reports/security/scanned_resource_spec.rb b/spec/lib/gitlab/ci/reports/security/scanned_resource_spec.rb index e9daa05e8b9..74a5344f79e 100644 --- a/spec/lib/gitlab/ci/reports/security/scanned_resource_spec.rb +++ b/spec/lib/gitlab/ci/reports/security/scanned_resource_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'spec_helper' +require 'fast_spec_helper' RSpec.describe Gitlab::Ci::Reports::Security::ScannedResource do let(:url) { 'http://example.com:3001/1?foo=bar' } diff --git a/spec/lib/gitlab/ci/reports/terraform_reports_spec.rb b/spec/lib/gitlab/ci/reports/terraform_reports_spec.rb index 5e94fe2bb3d..f754786d071 100644 --- a/spec/lib/gitlab/ci/reports/terraform_reports_spec.rb +++ b/spec/lib/gitlab/ci/reports/terraform_reports_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'spec_helper' +require 'fast_spec_helper' RSpec.describe Gitlab::Ci::Reports::TerraformReports do it 'initializes plans with and empty hash' do |