diff options
author | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2014-02-25 14:57:42 +0400 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2014-02-25 14:57:42 +0400 |
commit | 0432bdf19eb3483e109582832a36dc7a3601a384 (patch) | |
tree | b238509c11cfb5e43e419d2b35a2404d8f49a95f /spec/lib/gitlab/popen_spec.rb | |
parent | 9f20580ed7338e72ffeadff86c0d605a2802c957 (diff) |
Change Gitlab::Popen to use arrays for commands
Diffstat (limited to 'spec/lib/gitlab/popen_spec.rb')
-rw-r--r-- | spec/lib/gitlab/popen_spec.rb | 11 |
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 |