BigW Consortium Gitlab

status_entity_spec.rb 894 Bytes
Newer Older
1 2 3
require 'spec_helper'

describe StatusEntity do
4
  let(:entity) { described_class.new(status) }
5

6 7
  let(:status) do
    Gitlab::Ci::Status::Success.new(double('object'), double('user'))
8 9 10 11 12 13 14
  end

  before do
    allow(status).to receive(:has_details?).and_return(true)
    allow(status).to receive(:details_path).and_return('some/path')
  end

15 16
  describe '#as_json' do
    subject { entity.as_json }
17

18
    it 'contains status details' do
19
      expect(subject).to include :text, :icon, :favicon, :label, :group
20
      expect(subject).to include :has_details, :details_path
Luke "Jared" Bennett committed
21 22 23 24 25 26
      expect(subject[:favicon]).to eq('/assets/ci_favicons/favicon_status_success.ico')
    end

    it 'contains a dev namespaced favicon if dev env' do
      allow(Rails.env).to receive(:development?) { true }
      expect(entity.as_json[:favicon]).to eq('/assets/ci_favicons/dev/favicon_status_success.ico')
27
    end
28 29
  end
end