2016-12-07 15:46:37 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe StatusEntity do
|
2016-12-15 14:57:35 +00:00
|
|
|
let(:entity) { described_class.new(status) }
|
2016-12-07 15:46:37 +00:00
|
|
|
|
2016-12-15 14:57:35 +00:00
|
|
|
let(:status) do
|
|
|
|
Gitlab::Ci::Status::Success.new(double('object'), double('user'))
|
2016-12-07 15:46:37 +00: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 13:47:20 +00:00
|
|
|
describe '#as_json' do
|
|
|
|
subject { entity.as_json }
|
2016-12-07 15:46:37 +00:00
|
|
|
|
2016-12-21 13:47:20 +00:00
|
|
|
it 'contains status details' do
|
2017-03-06 15:09:48 +00:00
|
|
|
expect(subject).to include :text, :icon, :favicon, :label, :group
|
2016-12-21 13:47:20 +00:00
|
|
|
expect(subject).to include :has_details, :details_path
|
2017-10-03 14:47:56 +00:00
|
|
|
expect(subject[:favicon]).to match_asset_path('/assets/ci_favicons/favicon_status_success.ico')
|
2017-04-25 17:36:05 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'contains a dev namespaced favicon if dev env' do
|
|
|
|
allow(Rails.env).to receive(:development?) { true }
|
2017-10-03 14:47:56 +00:00
|
|
|
expect(entity.as_json[:favicon]).to match_asset_path('/assets/ci_favicons/dev/favicon_status_success.ico')
|
2016-12-21 13:47:20 +00:00
|
|
|
end
|
2016-12-07 15:46:37 +00:00
|
|
|
end
|
|
|
|
end
|