2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe StatusEntity do
|
|
|
|
let(:entity) { described_class.new(status) }
|
|
|
|
|
|
|
|
let(:status) do
|
|
|
|
Gitlab::Ci::Status::Success.new(double('object'), double('user'))
|
|
|
|
end
|
|
|
|
|
|
|
|
before do
|
|
|
|
allow(status).to receive(:has_details?).and_return(true)
|
|
|
|
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, :favicon, :label, :group
|
|
|
|
expect(subject).to include :has_details, :details_path
|
2018-03-17 18:26:18 +05:30
|
|
|
expect(subject[:favicon]).to match_asset_path('/assets/ci_favicons/favicon_status_success.ico')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'contains a dev namespaced favicon if dev env' do
|
|
|
|
allow(Rails.env).to receive(:development?) { true }
|
2018-03-17 18:26:18 +05:30
|
|
|
expect(entity.as_json[:favicon]).to match_asset_path('/assets/ci_favicons/dev/favicon_status_success.ico')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|