gitlab-org--gitlab-foss/spec/serializers/build_artifact_entity_spec.rb

36 lines
924 B
Ruby
Raw Normal View History

# frozen_string_literal: true
require 'spec_helper'
RSpec.describe BuildArtifactEntity do
let(:job) { create(:ci_build) }
let(:artifact) { create(:ci_job_artifact, :codequality, expire_at: 1.hour.from_now, job: job) }
let(:entity) do
described_class.new(artifact, request: double)
end
describe '#as_json' do
subject { entity.as_json }
it 'contains job name' do
expect(subject[:name]).to eq "test:codequality"
end
2017-05-29 03:58:20 -04:00
it 'exposes information about expiration of artifacts' do
expect(subject).to include(:expired, :expire_at)
end
it 'contains paths to the artifacts' do
expect(subject[:path])
.to include "jobs/#{job.id}/artifacts/download?file_type=codequality"
2017-05-29 03:58:20 -04:00
expect(subject[:keep_path])
2017-05-31 16:10:00 -04:00
.to include "jobs/#{job.id}/artifacts/keep"
2017-05-29 03:58:20 -04:00
expect(subject[:browse_path])
2017-05-31 16:10:00 -04:00
.to include "jobs/#{job.id}/artifacts/browse"
end
end
end