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

push_options_spec.rb « git « gitlab « lib « spec « ruby - gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d2c74f39959c0fbe27239f0427e1a6e9dd8f33f8 (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
# frozen_string_literal: true

require 'spec_helper'

describe Gitlab::Git::PushOptions do
  subject { described_class.new(options) }

  describe '#env_data' do
    context 'when push options are set' do
      let(:options) { ['ci.skip', 'test=value'] }

      it 'sets GIT_PUSH_OPTION environment variables' do
        env_data = subject.env_data

        expect(env_data.count).to eq(3)
        expect(env_data['GIT_PUSH_OPTION_COUNT']).to eq('2')
        expect(env_data['GIT_PUSH_OPTION_0']).to eq('ci.skip')
        expect(env_data['GIT_PUSH_OPTION_1']).to eq('test=value')
      end
    end

    context 'when push options are not set' do
      let(:options) { [] }

      it 'does not set any variable' do
        env_data = subject.env_data

        expect(env_data).to eq({})
      end
    end
  end
end