debian-mirror-gitlab/spec/serializers/job_artifact_report_entity_spec.rb

29 lines
733 B
Ruby
Raw Normal View History

2019-09-04 21:01:54 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe JobArtifactReportEntity do
2019-09-04 21:01:54 +05:30
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
2019-12-26 22:10:19 +05:30
expect(subject[:download_path]).to include("jobs/#{report.job.id}/artifacts/download?file_type=#{report.file_type}")
2019-09-04 21:01:54 +05:30
end
end
end