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

default_spec.rb « inherit « 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: c0d21385ce6637d6549f7fbefed8c443fe339510 (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
38
39
40
41
42
43
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe ::Gitlab::Ci::Config::Entry::Inherit::Default do
  using RSpec::Parameterized::TableSyntax

  subject { described_class.new(config) }

  context 'validations' do
    where(:config, :valid) do
      true        | true
      false       | true
      %w[image]   | true
      %w[unknown] | false
      %i[image]   | false
      [true]      | false
      "string"    | false
    end

    with_them do
      it do
        expect(subject.valid?).to eq(valid)
      end
    end
  end

  describe '#inherit?' do
    where(:config, :inherit) do
      true              | true
      false             | false
      %w[image]         | true
      %w[before_script] | false
      '123'             | false
    end

    with_them do
      it do
        expect(subject.inherit?('image')).to eq(inherit)
      end
    end
  end
end