Commit d549a965 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add missing specs for new pipeline related entities

[ci skip]
parent c8b16068
......@@ -5,7 +5,7 @@ class PipelineActionEntity < Grape::Entity
build.name.humanize
end
expose :url do |build|
expose :path do |build|
play_namespace_project_build_path(
build.project.namespace,
build.project,
......
......@@ -5,7 +5,7 @@ class PipelineArtifactEntity < Grape::Entity
build.name
end
expose :url do |build|
expose :path do |build|
download_namespace_project_build_artifacts_path(
build.project.namespace,
build.project,
......
class StatusEntity < Grape::Entity
include RequestAwareEntity
expose :icon, :text, :label
expose :icon, :text, :label, :group
expose :has_details?, as: :has_details
expose :details_path
......
require 'spec_helper'
describe PipelineActionEntity do
let(:build) { create(:ci_build, name: 'test_build') }
let(:entity) do
described_class.new(build, request: double)
end
describe '#as_json' do
subject { entity.as_json }
it 'contains humanized build name' do
expect(subject[:name]).to eq 'Test build'
end
it 'contains path to the action play' do
expect(subject[:path]).to include "builds/#{build.id}/play"
end
end
end
require 'spec_helper'
describe PipelineArtifactEntity do
let(:build) { create(:ci_build, name: 'test:build') }
let(:entity) do
described_class.new(build, request: double)
end
describe '#as_json' do
subject { entity.as_json }
it 'contains build name' do
expect(subject[:name]).to eq 'test:build'
end
it 'contains path to the artifacts' do
expect(subject[:path])
.to include "builds/#{build.id}/artifacts/download"
end
end
end
......@@ -12,11 +12,12 @@ describe StatusEntity do
allow(status).to receive(:details_path).and_return('some/path')
end
describe '#as_json' do
subject { entity.as_json }
it 'contains status details' do
expect(subject).to include :text, :icon, :label
expect(subject).to include :has_details
expect(subject).to include :details_path
expect(subject).to include :text, :icon, :label, :group
expect(subject).to include :has_details, :details_path
end
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