summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/ci/status/build/preparing_spec.rb
blob: 4d8945845ba5d5d4c0d56afa17d0821a209a4eee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# frozen_string_literal: true

require 'spec_helper'

describe Gitlab::Ci::Status::Build::Preparing do
  subject do
    described_class.new(double('subject'))
  end

  describe '#illustration' do
    it { expect(subject.illustration).to include(:image, :size, :title, :content) }
  end

  describe '.matches?' do
    subject { described_class.matches?(build, nil) }

    context 'when build is preparing' do
      let(:build) { create(:ci_build, :preparing) }

      it 'is a correct match' do
        expect(subject).to be true
      end
    end

    context 'when build is not preparing' do
      let(:build) { create(:ci_build, :success) }

      it 'does not match' do
        expect(subject).to be false
      end
    end
  end
end