diff options
Diffstat (limited to 'spec/serializers')
-rw-r--r-- | spec/serializers/build_details_entity_spec.rb | 8 | ||||
-rw-r--r-- | spec/serializers/job_artifact_entity_spec.rb | 28 |
2 files changed, 36 insertions, 0 deletions
diff --git a/spec/serializers/build_details_entity_spec.rb b/spec/serializers/build_details_entity_spec.rb index 9c2e5c79a9d..0b8ed873bde 100644 --- a/spec/serializers/build_details_entity_spec.rb +++ b/spec/serializers/build_details_entity_spec.rb @@ -146,5 +146,13 @@ describe BuildDetailsEntity do end end end + + context 'when the build has reports' do + let!(:report) { create(:ci_job_artifact, :codequality, job: build) } + + it 'exposes the report artifacts' do + expect(subject[:reports]).not_to be_empty + end + end end end diff --git a/spec/serializers/job_artifact_entity_spec.rb b/spec/serializers/job_artifact_entity_spec.rb new file mode 100644 index 00000000000..4188be56473 --- /dev/null +++ b/spec/serializers/job_artifact_entity_spec.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe JobArtifactEntity do + let(:report) { create(:ci_job_artifact, :codequality) } + let(:entity) { described_class.new(report, request: double) } + + describe '#as_json' do + subject { entity.as_json } + + it 'exposes file_type' do + expect(subject[:file_type]).to eq(report.file_type) + end + + it 'exposes file_format' do + expect(subject[:file_format]).to eq(report.file_format) + end + + it 'exposes size' do + expect(subject[:size]).to eq(report.size) + end + + it 'exposes download path' do + expect(subject[:download_path]).to include("jobs/#{report.job.id}/artifacts/download") + end + end +end |