Welcome to mirror list, hosted at ThFree Co, Russian Federation.

need_spec.rb « entry « config « ci « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d119e60490085b92115ab94736e56779b7ab0669 (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
34
35
36
# frozen_string_literal: true

require 'spec_helper'

describe ::Gitlab::Ci::Config::Entry::Need do
  subject(:need) { described_class.new(config) }

  context 'when job is specified' do
    let(:config) { 'job_name' }

    describe '#valid?' do
      it { is_expected.to be_valid }
    end

    describe '#value' do
      it 'returns job needs configuration' do
        expect(need.value).to eq(name: 'job_name')
      end
    end
  end

  context 'when need is empty' do
    let(:config) { '' }

    describe '#valid?' do
      it { is_expected.not_to be_valid }
    end

    describe '#errors' do
      it 'is returns an error about an empty config' do
        expect(need.errors)
          .to contain_exactly("job config can't be blank")
      end
    end
  end
end