2016-12-07 10:46:37 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe StatusEntity do
|
2016-12-15 09:57:35 -05:00
|
|
|
let(:entity) { described_class.new(status) }
|
2016-12-07 10:46:37 -05:00
|
|
|
|
2016-12-15 09:57:35 -05:00
|
|
|
let(:status) do
|
|
|
|
Gitlab::Ci::Status::Success.new(double('object'), double('user'))
|
2016-12-07 10:46:37 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
before do
|
|
|
|
allow(status).to receive(:has_details?).and_return(true)
|
|
|
|
allow(status).to receive(:details_path).and_return('some/path')
|
|
|
|
end
|
|
|
|
|
2016-12-21 08:47:20 -05:00
|
|
|
describe '#as_json' do
|
|
|
|
subject { entity.as_json }
|
2016-12-07 10:46:37 -05:00
|
|
|
|
2016-12-21 08:47:20 -05:00
|
|
|
it 'contains status details' do
|
2018-04-05 17:04:42 -04:00
|
|
|
expect(subject).to include :text, :icon, :favicon, :label, :group, :tooltip
|
2016-12-21 08:47:20 -05:00
|
|
|
expect(subject).to include :has_details, :details_path
|
2017-12-07 07:15:49 -05:00
|
|
|
expect(subject[:favicon]).to match_asset_path('/assets/ci_favicons/favicon_status_success.png')
|
2017-04-25 13:36:05 -04:00
|
|
|
end
|
2016-12-07 10:46:37 -05:00
|
|
|
end
|
|
|
|
end
|