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

builder_spec.rb « variables « ci « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5ff34592b2fa4d58698ae03023cd11d147da6e18 (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::Ci::Variables::Builder do
  let(:builder) { described_class.new(pipeline) }
  let(:pipeline) { create(:ci_pipeline) }
  let(:job) { create(:ci_build, pipeline: pipeline) }

  describe '#scoped_variables' do
    let(:environment) { job.expanded_environment_name }
    let(:dependencies) { true }

    subject { builder.scoped_variables(job, environment: environment, dependencies: dependencies) }

    it 'returns the expected variables' do
      keys = %w[CI_JOB_NAME
                CI_JOB_STAGE
                CI_NODE_TOTAL
                CI_BUILD_NAME
                CI_BUILD_STAGE]

      subject.map { |env| env[:key] }.tap do |names|
        expect(names).to include(*keys)
      end
    end
  end
end