summaryrefslogtreecommitdiff
path: root/spec/mixlib
diff options
context:
space:
mode:
authorHo-Sheng Hsiao <hosheng.hsiao@gmail.com>2012-03-23 12:09:48 -0400
committerHo-Sheng Hsiao <hosheng.hsiao@gmail.com>2012-03-23 12:09:48 -0400
commitd3c4419b6e0608b5f46eb92b2cd119c51f473adb (patch)
tree1923481b9de464d8f5223514adcdadc8edc24744 /spec/mixlib
parent26f38cac8dc1989019e3a24c5a5900e866725034 (diff)
downloadmixlib-shellout-d3c4419b6e0608b5f46eb92b2cd119c51f473adb.tar.gz
[RSPEC] Refactored spec for subprocess that timesout
Diffstat (limited to 'spec/mixlib')
-rw-r--r--spec/mixlib/shellout/shellout_spec.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/spec/mixlib/shellout/shellout_spec.rb b/spec/mixlib/shellout/shellout_spec.rb
index 6815c64..bc84be8 100644
--- a/spec/mixlib/shellout/shellout_spec.rb
+++ b/spec/mixlib/shellout/shellout_spec.rb
@@ -543,9 +543,13 @@ describe Mixlib::ShellOut do
end
end
- it "times out when a process takes longer than the specified timeout" do
- cmd = Mixlib::ShellOut.new("ruby -e \"sleep 2\"", :timeout => 0.1)
- lambda {cmd.run_command}.should raise_error(Mixlib::ShellOut::CommandTimeout)
+ context 'with subprocess that takes longer than timeout' do
+ let(:shell_cmd) { Mixlib::ShellOut.new(cmd, :timeout => 0.1) }
+ let(:cmd) { ruby_eval.call('sleep 2') }
+
+ it "should raise CommandTimeout" do
+ lambda { executed_cmd }.should raise_error(Mixlib::ShellOut::CommandTimeout)
+ end
end
it "reads all of the output when the subprocess produces more than $buffersize of output" do