2019-12-21 20:55:43 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe DetailedStatusEntity do
|
2017-08-17 22:00:37 +05:30
|
|
|
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
|
2018-05-09 12:01:36 +05:30
|
|
|
expect(subject).to include :text, :icon, :favicon, :label, :group, :tooltip
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(subject).to include :has_details, :details_path
|
2018-11-08 19:23:39 +05:30
|
|
|
expect(subject[:favicon]).to match_asset_path('/assets/ci_favicons/favicon_status_success.png')
|
2018-05-09 12:01:36 +05:30
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|