Commit 51183ad3 authored by Matija Čupić's avatar Matija Čupić

Add all reports scope to Ci::JobArtifact

parent df7bebd6
......@@ -66,6 +66,10 @@ module Ci
where(file_type: types)
end
scope :with_all_reports, -> do
where(file_type: self.file_types.values.drop(3))
end
scope :test_reports, -> do
with_file_types(TEST_REPORT_FILE_TYPES)
end
......
......@@ -23,6 +23,21 @@ describe Ci::JobArtifact do
it_behaves_like 'having unique enum values'
describe '.with_all_reports' do
let!(:artifact) { create(:ci_job_artifact, :archive) }
subject { described_class.with_all_reports }
it { is_expected.to be_empty }
context 'when there are reports' do
let!(:metrics_report) { create(:ci_job_artifact, :junit) }
let!(:codequality_report) { create(:ci_job_artifact, :codequality) }
it { is_expected.to eq([metrics_report, codequality_report]) }
end
end
describe '.test_reports' do
subject { described_class.test_reports }
......
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