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

hooks_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: 7a5ff244e189a7ce0198016022ccfd6950f44b92 (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
37
# frozen_string_literal: true

RSpec.describe Gitlab::Ci::Config::Entry::Hooks do
  subject(:entry) { described_class.new(config) }

  before do
    entry.compose!
  end

  describe 'validations' do
    context 'when passing a valid hook' do
      let(:config) { { pre_get_sources_script: ['ls'] } }

      it { is_expected.to be_valid }
    end

    context 'when passing an invalid hook' do
      let(:config) { { x_get_something: ['ls'] } }

      it { is_expected.not_to be_valid }
    end

    context 'when entry config is not a hash' do
      let(:config) { 'ls' }

      it { is_expected.not_to be_valid }
    end
  end

  describe '#value' do
    let(:config) { { pre_get_sources_script: ['ls'] } }

    it 'returns a hash' do
      expect(entry.value).to eq(config)
    end
  end
end