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

info_rake_spec.rb « gitlab « tasks « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ca74378a12a5a545bcc0066bff388b4ae3f0c920 (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
require 'rake_helper'

describe 'gitlab:env:info' do
  before do
    Rake.application.rake_require 'tasks/gitlab/info'

    stub_warn_user_is_not_gitlab
    allow(Gitlab::Popen).to receive(:popen)
  end

  describe 'git version' do
    before do
      allow(Gitlab::Popen).to receive(:popen).with([Gitlab.config.git.bin_path, '--version'])
        .and_return(git_version)
    end

    context 'when git installed' do
      let(:git_version) { 'git version 2.10.0' }

      it 'prints git version' do
        run_rake_task('gitlab:env:info')

        expect($stdout.string).to match(/Git Version:(.*)2.10.0/)
      end
    end

    context 'when git not installed' do
      let(:git_version) { '' }

      it 'prints unknown' do
        run_rake_task('gitlab:env:info')

        expect($stdout.string).to match(/Git Version:(.*)unknown/)
      end
    end
  end
end