BigW Consortium Gitlab

ci_status_helper_spec.rb 1 KB
Newer Older
1 2 3 4 5
require 'spec_helper'

describe CiStatusHelper do
  include IconsHelper

6 7
  let(:success_commit) { double("Ci::Pipeline", status: 'success') }
  let(:failed_commit) { double("Ci::Pipeline", status: 'failed') }
8

Kamil Trzcinski committed
9
  describe 'ci_icon_for_status' do
10 11 12 13 14 15 16 17
    it 'renders to correct svg on success' do
      expect(helper).to receive(:render).with('shared/icons/icon_status_success.svg', anything)
      helper.ci_icon_for_status(success_commit.status)
    end
    it 'renders the correct svg on failure' do
      expect(helper).to receive(:render).with('shared/icons/icon_status_failed.svg', anything)
      helper.ci_icon_for_status(failed_commit.status)
    end
18
  end
19 20 21

  describe "#pipeline_status_cache_key" do
    it "builds a cache key for pipeline status" do
22
      pipeline_status = Gitlab::Cache::Ci::ProjectPipelineStatus.new(
23 24 25 26
        build(:project),
        sha: "123abc",
        status: "success"
      )
27 28 29
      expect(helper.pipeline_status_cache_key(pipeline_status)).to eq("pipeline-status/123abc-success")
    end
  end
30
end