summaryrefslogtreecommitdiff
path: root/spec/tasks
diff options
context:
space:
mode:
authorSemyon Pupkov <mail@semyonpupkov.com>2016-12-06 23:19:37 +0500
committerSemyon Pupkov <mail@semyonpupkov.com>2017-02-28 20:42:13 +0500
commite73b68a74217cf736dafd2ce1448292f3df5543d (patch)
treeb415253d4fc89c6863fc8e62d47bf38afc7144f5 /spec/tasks
parent58758bd5921a3f70918b23f90443812e6088a29c (diff)
downloadgitlab-ce-e73b68a74217cf736dafd2ce1448292f3df5543d.tar.gz
Add git version to gitlab:env:info
https://gitlab.com/gitlab-org/gitlab-ce/issues/25376
Diffstat (limited to 'spec/tasks')
-rw-r--r--spec/tasks/gitlab/info_rake_spec.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/tasks/gitlab/info_rake_spec.rb b/spec/tasks/gitlab/info_rake_spec.rb
new file mode 100644
index 00000000000..ca74378a12a
--- /dev/null
+++ b/spec/tasks/gitlab/info_rake_spec.rb
@@ -0,0 +1,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