summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2015-11-25 18:00:17 +0100
committerJacob Vosmaer <contact@jacobvosmaer.nl>2015-11-25 18:00:17 +0100
commitca66ab5191510aac5c71f3ab7ad3172d1cf3b67a (patch)
tree0ea953ad64825c3995bd67c162b079bec53bd32a
parent712daa411a2ab3d0add9d9e4a5b36ca81b53f674 (diff)
downloadgitlab-shell-ca66ab5191510aac5c71f3ab7ad3172d1cf3b67a.tar.gz
Add spec for stricter exec_cmd checks
-rw-r--r--spec/gitlab_shell_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/gitlab_shell_spec.rb b/spec/gitlab_shell_spec.rb
index 051cac4..86d72f4 100644
--- a/spec/gitlab_shell_spec.rb
+++ b/spec/gitlab_shell_spec.rb
@@ -236,6 +236,15 @@ describe GitlabShell do
Kernel.should_receive(:exec).with(kind_of(Hash), 1, 2, unsetenv_others: true).once
shell.send :exec_cmd, 1, 2
end
+
+ it "refuses to execute a lone non-array argument" do
+ expect { shell.send :exec_cmd, 1 }.to raise_error(GitlabShell::DisallowedCommandError)
+ end
+
+ it "allows one argument if it is an array" do
+ Kernel.should_receive(:exec).with(kind_of(Hash), [1, 2], unsetenv_others: true).once
+ shell.send :exec_cmd, [1, 2]
+ end
end
describe :api do