diff options
author | Ho-Sheng Hsiao <hosheng.hsiao@gmail.com> | 2012-03-26 18:29:40 -0400 |
---|---|---|
committer | Ho-Sheng Hsiao <hosheng.hsiao@gmail.com> | 2012-03-26 18:29:40 -0400 |
commit | 310b1e3d5f99a5d1295718ef064e988984768bc1 (patch) | |
tree | c92c10dd4ae1714cc3391044760bcd713f8f3bc5 /spec | |
parent | 3fb28af15fd0dd47cf81b92758a3ebf30627674e (diff) | |
download | mixlib-shellout-310b1e3d5f99a5d1295718ef064e988984768bc1.tar.gz |
[CHEF-2994][RSPEC] ShellOut#run_command when exiting with invalid code with input data shuld handle exit code gracefully
Diffstat (limited to 'spec')
-rw-r--r-- | spec/mixlib/shellout/shellout_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/mixlib/shellout/shellout_spec.rb b/spec/mixlib/shellout/shellout_spec.rb index 7d37a3e..62ac3e5 100644 --- a/spec/mixlib/shellout/shellout_spec.rb +++ b/spec/mixlib/shellout/shellout_spec.rb @@ -593,6 +593,19 @@ describe Mixlib::ShellOut do it "should set the exit status of the command" do exit_status.should eql(exit_code) end + + context 'with input data' do + let(:options) { { :returns => valid_exit_codes, :input => input } } + let(:input) { "Random data #{rand(1000000)}" } + + it "should raise ShellCommandFailed" do + lambda { executed_cmd.error! }.should raise_error(Mixlib::ShellOut::ShellCommandFailed) + end + + it "should set the exit status of the command" do + exit_status.should eql(exit_code) + end + end end context 'when exiting with invalid code 0' do |