Commit ca66ab51 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Add spec for stricter exec_cmd checks

parent 712daa41
...@@ -236,6 +236,15 @@ describe GitlabShell do ...@@ -236,6 +236,15 @@ describe GitlabShell do
Kernel.should_receive(:exec).with(kind_of(Hash), 1, 2, unsetenv_others: true).once Kernel.should_receive(:exec).with(kind_of(Hash), 1, 2, unsetenv_others: true).once
shell.send :exec_cmd, 1, 2 shell.send :exec_cmd, 1, 2
end 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 end
describe :api do describe :api do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment