From 72c5e95e976287805d3910073d7c0c4fe4324a98 Mon Sep 17 00:00:00 2001 From: Ho-Sheng Hsiao Date: Fri, 23 Mar 2012 12:21:39 -0400 Subject: [RSPEC] Refactored spec for subprocess that exceeds buffersize --- spec/mixlib/shellout/shellout_spec.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/spec/mixlib/shellout/shellout_spec.rb b/spec/mixlib/shellout/shellout_spec.rb index bc84be8..757c94a 100644 --- a/spec/mixlib/shellout/shellout_spec.rb +++ b/spec/mixlib/shellout/shellout_spec.rb @@ -552,11 +552,13 @@ describe Mixlib::ShellOut do end end - it "reads all of the output when the subprocess produces more than $buffersize of output" do - chatty = "ruby -e \"print('X' * 16 * 1024); print('.' * 1024)\"" - cmd = Mixlib::ShellOut.new(chatty) - cmd.run_command - cmd.stdout.should match(/X{16384}\.{1024}/) + context 'with subprocess that exceeds buffersize' do + let(:chatty) { 'print("X" * 16 * 1024); print("." * 1024)' } + let(:cmd) { ruby_eval.call(chatty) } + + it "should still reads all of the output" do + stdout.should match(/X{16384}\.{1024}/) + end end it "returns empty strings from commands that have no output" do -- cgit v1.2.1