Make the Gitlab::Popen path argument optional
This commit is contained in:
parent
0432bdf19e
commit
8016cefafe
|
@ -3,11 +3,12 @@ require 'open3'
|
|||
|
||||
module Gitlab
|
||||
module Popen
|
||||
def popen(cmd, path)
|
||||
def popen(cmd, path=nil)
|
||||
unless cmd.is_a?(Array)
|
||||
raise "System commands must be given as an array of strings"
|
||||
end
|
||||
|
||||
path ||= Dir.pwd
|
||||
vars = { "PWD" => path }
|
||||
options = { chdir: path }
|
||||
|
||||
|
|
|
@ -32,5 +32,14 @@ describe 'Gitlab::Popen', no_db: true do
|
|||
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
|
||||
|
||||
|
|
Loading…
Reference in New Issue