diff options
author | Stan Hu <stanhu@gmail.com> | 2017-07-03 21:28:29 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-07-03 21:28:29 +0300 |
commit | d8cc0d0115aefe02b611489a89cb11c125d802af (patch) | |
tree | da46f17d9e5b64aaee0010a02971a5f4f2b70fba /spec/lib/gitlab/popen_spec.rb | |
parent | 0f30bcf15d325031912fdb041339902a164cf17b (diff) |
Speed up operations performed by gitlab-shell
Diffstat (limited to 'spec/lib/gitlab/popen_spec.rb')
-rw-r--r-- | spec/lib/gitlab/popen_spec.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/spec/lib/gitlab/popen_spec.rb b/spec/lib/gitlab/popen_spec.rb index 4ae216d55b0..af50ecdb2ab 100644 --- a/spec/lib/gitlab/popen_spec.rb +++ b/spec/lib/gitlab/popen_spec.rb @@ -32,6 +32,17 @@ describe 'Gitlab::Popen', lib: true, no_db: true do end end + context 'with custom options' do + let(:vars) { { 'foobar' => 123, 'PWD' => path } } + let(:options) { { chdir: path } } + + it 'calls popen3 with the provided environment variables' do + expect(Open3).to receive(:popen3).with(vars, 'ls', options) + + @output, @status = @klass.new.popen(%w(ls), path, { 'foobar' => 123 }) + end + end + context 'without a directory argument' do before do @output, @status = @klass.new.popen(%w(ls)) @@ -45,7 +56,7 @@ describe 'Gitlab::Popen', lib: true, no_db: true do before do @output, @status = @klass.new.popen(%w[cat]) { |stdin| stdin.write 'hello' } end - + it { expect(@status).to be_zero } it { expect(@output).to eq('hello') } end |