diff options
author | Louise Crow <louise.crow@gmail.com> | 2014-01-23 14:46:33 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2014-01-23 14:46:33 +0000 |
commit | 3041e9b8286fbdd23467b70efd4318c32abb48a2 (patch) | |
tree | e472d5c7d640ba6805fe06d8024b5211b19507cc /spec/lib/alaveteli_external_command.rb | |
parent | 09a7180b3f5ddbed54da23a6985fff196cc36af2 (diff) | |
parent | 75900830370801d51743a61f0c1e4793f2f91b4f (diff) |
Merge branch 'trap-abnormal-exits' into rails-3-develop
Diffstat (limited to 'spec/lib/alaveteli_external_command.rb')
-rw-r--r-- | spec/lib/alaveteli_external_command.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/lib/alaveteli_external_command.rb b/spec/lib/alaveteli_external_command.rb new file mode 100644 index 000000000..18afeda33 --- /dev/null +++ b/spec/lib/alaveteli_external_command.rb @@ -0,0 +1,23 @@ +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') + +require 'alaveteli_external_command' + +script_dir = File.join(File.dirname(__FILE__), 'alaveteli_external_command_scripts') +segfault_script = File.join(script_dir, 'segfault.sh') +error_script = File.join(script_dir, 'error.sh') + +describe "when running external commands" do + + it "should detect a non-zero exit status" do + $stderr.should_receive(:puts).with(/Error from/) + t = AlaveteliExternalCommand.run(error_script) + assert_nil t + end + + it "should detect when an external command crashes" do + $stderr.should_receive(:puts).with(/exited abnormally/) + t = AlaveteliExternalCommand.run(segfault_script) + assert_nil t + end + +end |