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

35 lines
841 B
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
require 'spec_helper'
describe BuildArtifactEntity do
2017-09-10 17:25:29 +05:30
let(:job) { create(:ci_build, name: 'test:job', artifacts_expire_at: 1.hour.from_now) }
2017-08-17 22:00:37 +05:30
let(:entity) do
2017-09-10 17:25:29 +05:30
described_class.new(job, request: double)
2017-08-17 22:00:37 +05:30
end
describe '#as_json' do
subject { entity.as_json }
2017-09-10 17:25:29 +05:30
it 'contains job name' do
expect(subject[:name]).to eq 'test:job'
2017-08-17 22:00:37 +05:30
end
2017-09-10 17:25:29 +05:30
it 'exposes information about expiration of artifacts' do
expect(subject).to include(:expired, :expire_at)
end
it 'contains paths to the artifacts' do
2017-08-17 22:00:37 +05:30
expect(subject[:path])
2017-09-10 17:25:29 +05:30
.to include "jobs/#{job.id}/artifacts/download"
expect(subject[:keep_path])
.to include "jobs/#{job.id}/artifacts/keep"
expect(subject[:browse_path])
.to include "jobs/#{job.id}/artifacts/browse"
2017-08-17 22:00:37 +05:30
end
end
end