Commit c5a3d8cb authored by Maxime Orefice's avatar Maxime Orefice

Add missing specs for API::Entities::Ci

This commit adds missing specs for 2 entities exposed in our API:
- API::Entities::Ci::JobArtifactFile
- API::Entities::Ci::JobRequest::Dependency
parent 45a8ef8a
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe API::Entities::Ci::JobArtifactFile do
let(:artifact_file) { instance_double(JobArtifactUploader, filename: 'ci_build_artifacts.zip', cached_size: 42) }
let(:entity) { described_class.new(artifact_file) }
subject { entity.as_json }
it 'returns the filename' do
expect(subject[:filename]).to eq('ci_build_artifacts.zip')
end
it 'returns the size' do
expect(subject[:size]).to eq(42)
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe API::Entities::Ci::JobRequest::Dependency do
let(:job) { create(:ci_build, :artifacts) }
let(:entity) { described_class.new(job) }
subject { entity.as_json }
it 'returns the dependency id' do
expect(subject[:id]).to eq(job.id)
end
it 'returns the dependency name' do
expect(subject[:name]).to eq(job.name)
end
it 'returns the dependency token' do
expect(subject[:token]).to eq(job.token)
end
it 'returns the dependency artifacts_file', :aggregate_failures do
expect(subject[:artifacts_file][:filename]).to eq('ci_build_artifacts.zip')
expect(subject[:artifacts_file][:size]).to eq(job.artifacts_size)
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment