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 ...@@ -5,7 +5,7 @@ class PipelineActionEntity < Grape::Entity
build.name.humanize build.name.humanize
end end
expose :url do |build| expose :path do |build|
play_namespace_project_build_path( play_namespace_project_build_path(
build.project.namespace, build.project.namespace,
build.project, build.project,
......
...@@ -5,7 +5,7 @@ class PipelineArtifactEntity < Grape::Entity ...@@ -5,7 +5,7 @@ class PipelineArtifactEntity < Grape::Entity
build.name build.name
end end
expose :url do |build| expose :path do |build|
download_namespace_project_build_artifacts_path( download_namespace_project_build_artifacts_path(
build.project.namespace, build.project.namespace,
build.project, build.project,
......
class StatusEntity < Grape::Entity class StatusEntity < Grape::Entity
include RequestAwareEntity include RequestAwareEntity
expose :icon, :text, :label expose :icon, :text, :label, :group
expose :has_details?, as: :has_details expose :has_details?, as: :has_details
expose :details_path 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 ...@@ -12,11 +12,12 @@ describe StatusEntity do
allow(status).to receive(:details_path).and_return('some/path') allow(status).to receive(:details_path).and_return('some/path')
end end
describe '#as_json' do
subject { entity.as_json } subject { entity.as_json }
it 'contains status details' do it 'contains status details' do
expect(subject).to include :text, :icon, :label expect(subject).to include :text, :icon, :label, :group
expect(subject).to include :has_details expect(subject).to include :has_details, :details_path
expect(subject).to include :details_path end
end 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