summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-03-07 10:05:02 +0000
committerRémy Coutable <remy@rymai.me>2017-03-07 10:05:02 +0000
commit9533fc355c956a9a8f8c357c5f6f7a503cdd1344 (patch)
tree22496c3a9d51eb5be9a4a69445a406704e1d2eca /spec
parent56814482d66edd49fc8eeb26896e6cfe788b984e (diff)
parente73b68a74217cf736dafd2ce1448292f3df5543d (diff)
downloadgitlab-ce-9533fc355c956a9a8f8c357c5f6f7a503cdd1344.tar.gz
Merge branch 'add-git-version-to-system-info' into 'master'
Add git version to gitlab:env:info Closes #25376 See merge request !9128
Diffstat (limited to 'spec')
-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