Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-02-26 19:38:56 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-02-26 19:38:56 +0400
commit63d0c0b93ba702340f9adf8e2772ecaddab635af (patch)
treebfc5fc4be7383c61289927d693b8ca922566b110 /spec
parent6c1af645668689f9d0e1b0693ea0db80b62d0bb3 (diff)
parent36c2c354fc4829827960d202a070f8e7b87c9446 (diff)
Merge branch 'gitlab_popen_array' into 'master'
Change Gitlab::Popen to only accept arrays as commands
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/popen_spec.rb20
1 files changed, 18 insertions, 2 deletions
diff --git a/spec/lib/gitlab/popen_spec.rb b/spec/lib/gitlab/popen_spec.rb
index 4791be41613..76d506eb3c0 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,27 @@ 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
+
+ context 'without a directory argument' do
+ before do
+ @output, @status = @klass.new.popen(%W(ls))
+ end
+
+ it { @status.should be_zero }
+ it { @output.should include('spec') }
+ end
+
end