Commit 233fdeb8 authored by Tetiana Chupryna's avatar Tetiana Chupryna

Test EE functionality in module test

parent 146eef9f
# frozen_string_literal: true
require 'spec_helper'
describe Ci::JobArtifact do
include EE::GeoHelpers
describe '#destroy' do
let_it_be(:primary) { create(:geo_node, :primary) }
let_it_be(:secondary) { create(:geo_node) }
it 'creates a JobArtifactDeletedEvent' do
stub_current_geo_node(primary)
job_artifact = create(:ci_job_artifact, :archive)
expect do
job_artifact.destroy
end.to change { Geo::JobArtifactDeletedEvent.count }.by(1)
end
end
describe '.security_reports' do
subject { described_class.security_reports }
context 'when there is a security report' do
let!(:artifact) { create(:ee_ci_job_artifact, :sast) }
it { is_expected.to eq([artifact]) }
end
context 'when there are no security reports' do
let!(:artifact) { create(:ci_job_artifact, :archive) }
it { is_expected.to be_empty }
end
end
end
...@@ -3,6 +3,23 @@ ...@@ -3,6 +3,23 @@
require 'spec_helper' require 'spec_helper'
describe EE::Ci::JobArtifact do describe EE::Ci::JobArtifact do
include EE::GeoHelpers
describe '#destroy' do
let_it_be(:primary) { create(:geo_node, :primary) }
let_it_be(:secondary) { create(:geo_node) }
it 'creates a JobArtifactDeletedEvent' do
stub_current_geo_node(primary)
job_artifact = create(:ee_ci_job_artifact, :archive)
expect do
job_artifact.destroy
end.to change { Geo::JobArtifactDeletedEvent.count }.by(1)
end
end
describe '.license_scanning_reports' do describe '.license_scanning_reports' do
subject { Ci::JobArtifact.license_scanning_reports } subject { Ci::JobArtifact.license_scanning_reports }
...@@ -35,6 +52,22 @@ describe EE::Ci::JobArtifact do ...@@ -35,6 +52,22 @@ describe EE::Ci::JobArtifact do
end end
end end
describe '.security_reports' do
subject { Ci::JobArtifact.security_reports }
context 'when there is a security report' do
let!(:artifact) { create(:ee_ci_job_artifact, :sast) }
it { is_expected.to eq([artifact]) }
end
context 'when there are no security reports' do
let!(:artifact) { create(:ci_job_artifact, :archive) }
it { is_expected.to be_empty }
end
end
describe '.associated_file_types_for' do describe '.associated_file_types_for' do
using RSpec::Parameterized::TableSyntax using RSpec::Parameterized::TableSyntax
......
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