Commit e4efb135 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add status entity prototype and expose in pipeline

parent ad19de19
...@@ -12,7 +12,7 @@ class PipelineEntity < Grape::Entity ...@@ -12,7 +12,7 @@ class PipelineEntity < Grape::Entity
end end
expose :details do expose :details do
expose :status expose :detailed_status, as: :status, using: StatusEntity
expose :duration expose :duration
expose :finished_at expose :finished_at
expose :stages_with_statuses, as: :stages, using: PipelineStageEntity expose :stages_with_statuses, as: :stages, using: PipelineStageEntity
......
class StatusEntity < Grape::Entity
include RequestAwareEntity
expose :icon, :text, :label, :title
expose :has_details?, as: :has_details
expose :details_path
end
require 'spec_helper'
describe StatusEntity do
let(:entity) do
described_class.new(status)
end
let(:status) do # TODO, add statuses factory
Gitlab::Ci::Status::Success.new(double('object'))
end
before do
allow(status).to receive(:has_details?).and_return(true)
allow(status).to receive(:details_path).and_return('some/path')
end
subject { entity.as_json }
it 'contains status details' do
expect(subject).to include :text, :icon, :label, :title
expect(subject).to include :has_details
expect(subject).to include :details_path
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