Add all reports scope to Ci::JobArtifact
This commit is contained in:
parent
df7bebd67c
commit
51183ad3bd
|
@ -66,6 +66,10 @@ module Ci
|
||||||
where(file_type: types)
|
where(file_type: types)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scope :with_all_reports, -> do
|
||||||
|
where(file_type: self.file_types.values.drop(3))
|
||||||
|
end
|
||||||
|
|
||||||
scope :test_reports, -> do
|
scope :test_reports, -> do
|
||||||
with_file_types(TEST_REPORT_FILE_TYPES)
|
with_file_types(TEST_REPORT_FILE_TYPES)
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,6 +23,21 @@ describe Ci::JobArtifact do
|
||||||
|
|
||||||
it_behaves_like 'having unique enum values'
|
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
|
describe '.test_reports' do
|
||||||
subject { described_class.test_reports }
|
subject { described_class.test_reports }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue