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

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

require 'spec_helper'

RSpec.describe Gitlab::Ci::Build::Context::Global do
  let(:pipeline)       { create(:ci_pipeline) }
  let(:yaml_variables) { {} }

  let(:context) { described_class.new(pipeline, yaml_variables: yaml_variables) }

  describe '#variables' do
    subject { context.variables }

    it { is_expected.to include('CI_COMMIT_REF_NAME' => 'master') }
    it { is_expected.to include('CI_PIPELINE_IID'    => pipeline.iid.to_s) }
    it { is_expected.to include('CI_PROJECT_PATH'    => pipeline.project.full_path) }

    it { is_expected.not_to have_key('CI_JOB_NAME') }
    it { is_expected.not_to have_key('CI_BUILD_REF_NAME') }

    context 'with passed yaml variables' do
      let(:yaml_variables) { [{ key: 'SUPPORTED', value: 'parsed', public: true }] }

      it { is_expected.to include('SUPPORTED' => 'parsed') }
    end
  end
end