summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/popen_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/popen_spec.rb')
-rw-r--r--spec/lib/gitlab/popen_spec.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/spec/lib/gitlab/popen_spec.rb b/spec/lib/gitlab/popen_spec.rb
index 4791be41613..a4a0846b7b9 100644
--- a/spec/lib/gitlab/popen_spec.rb
+++ b/spec/lib/gitlab/popen_spec.rb
@@ -10,7 +10,7 @@ describe 'Gitlab::Popen', no_db: true do
context 'zero status' do
before do
- @output, @status = @klass.new.popen('ls', path)
+ @output, @status = @klass.new.popen(%W(ls), path)
end
it { @status.should be_zero }
@@ -19,11 +19,18 @@ describe 'Gitlab::Popen', no_db: true do
context 'non-zero status' do
before do
- @output, @status = @klass.new.popen('cat NOTHING', path)
+ @output, @status = @klass.new.popen(%W(cat NOTHING), path)
end
it { @status.should == 1 }
it { @output.should include('No such file or directory') }
end
+
+ context 'unsafe string command' do
+ it 'raises an error when it gets called with a string argument' do
+ expect { @klass.new.popen('ls', path) }.to raise_error
+ end
+ end
+
end