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

includes_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: 54c0286801057dc2bf51f61335b9b04912d2e5a9 (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
# frozen_string_literal: true

require 'fast_spec_helper'
require_dependency 'active_model'

RSpec.describe ::Gitlab::Ci::Config::Entry::Includes, feature_category: :pipeline_composition do
  subject(:include_entry) { described_class.new(config) }

  describe '#initialize' do
    let(:config) { 'test.yml' }

    it 'does not increase aspects' do
      2.times { expect { described_class.new(config) }.not_to change { described_class.aspects.count } }
    end
  end

  describe 'validations' do
    let(:config) { [1, 2] }

    let(:includes_entry) { described_class.new(config, max_size: 1) }

    it 'returns invalid' do
      expect(includes_entry).not_to be_valid
    end

    it 'returns the appropriate error' do
      expect(includes_entry.errors).to include('includes config is too long (maximum is 1)')
    end
  end
end