summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHo-Sheng Hsiao <hosheng.hsiao@gmail.com>2012-03-23 16:35:52 -0400
committerHo-Sheng Hsiao <hosheng.hsiao@gmail.com>2012-03-23 16:36:27 -0400
commit068864614a7fb98b00fb77b95033b2012f68c6f1 (patch)
tree8146c768a468dcc1a23ecabb6cdf5798540bcfb5
parent274dee188ba467c5876796ff12ac82821c9bd2e3 (diff)
downloadmixlib-shellout-068864614a7fb98b00fb77b95033b2012f68c6f1.tar.gz
[RSPEC] Refactored spec for subprocess that writes, pauses, and writes
-rw-r--r--spec/mixlib/shellout/shellout_spec.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/spec/mixlib/shellout/shellout_spec.rb b/spec/mixlib/shellout/shellout_spec.rb
index 690b6df..8b1bdff 100644
--- a/spec/mixlib/shellout/shellout_spec.rb
+++ b/spec/mixlib/shellout/shellout_spec.rb
@@ -612,11 +612,14 @@ describe Mixlib::ShellOut do
end
end
- it "doesn't hang or lose output when a process writes, pauses, then continues writing" do
- stop_and_go = %q{ruby -e 'puts "before";sleep 0.5;puts"after"'}
- cmd = Mixlib::ShellOut.new(stop_and_go)
- cmd.run_command
- cmd.stdout.should == "before#{LINE_ENDING}after#{LINE_ENDING}"
+ context 'when subprocess writes, pauses, then continues writing' do
+ subject { stdout }
+ let(:stop_and_go) { %q{puts "before"; sleep 0.5; puts "after"} }
+ let(:cmd) { ruby_eval.call(stop_and_go) }
+
+ it 'should not hang or lose output' do
+ should eql("before#{LINE_ENDING}after#{LINE_ENDING}")
+ end
end
it "doesn't hang or lose output when a process pauses before writing" do