summaryrefslogtreecommitdiff
path: root/spec/tasks
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2017-09-25 00:30:53 +0200
committerGabriel Mazetto <brodock@gmail.com>2017-09-25 00:34:12 +0200
commitc505a5234745f4a879ad336a0de92586c9bc9162 (patch)
tree92ac3dfdcc81bce639bfc297adab13048bcf613f /spec/tasks
parente2b195b2748c88e276163d44cdeff5b210f2522c (diff)
downloadgitlab-ce-c505a5234745f4a879ad336a0de92586c9bc9162.tar.gz
Fixed few gitlab:check tasks that were failing with exception38280-undefined-run_command-when-running-rake-gitlab-check
Diffstat (limited to 'spec/tasks')
-rw-r--r--spec/tasks/gitlab/task_helpers_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/tasks/gitlab/task_helpers_spec.rb b/spec/tasks/gitlab/task_helpers_spec.rb
index d34617be474..fae5ec35c47 100644
--- a/spec/tasks/gitlab/task_helpers_spec.rb
+++ b/spec/tasks/gitlab/task_helpers_spec.rb
@@ -75,4 +75,24 @@ describe Gitlab::TaskHelpers do
subject.checkout_version(tag, clone_path)
end
end
+
+ describe '#run_command' do
+ it 'runs command and return the output' do
+ expect(subject.run_command(%w(echo it works!))).to eq("it works!\n")
+ end
+
+ it 'returns empty string when command doesnt exist' do
+ expect(subject.run_command(%w(nonexistentcommand with arguments))).to eq('')
+ end
+ end
+
+ describe '#run_command!' do
+ it 'runs command and return the output' do
+ expect(subject.run_command!(%w(echo it works!))).to eq("it works!\n")
+ end
+
+ it 'returns and exception when command exit with non zero code' do
+ expect { subject.run_command!(['bash', '-c', 'exit 1']) }.to raise_error Gitlab::TaskFailedError
+ end
+ end
end