aboutsummaryrefslogtreecommitdiffstats
path: root/spec/lib/alaveteli_external_command_spec.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2014-03-13 17:43:33 +0000
committerLouise Crow <louise.crow@gmail.com>2014-03-13 17:44:24 +0000
commit0ec573f4c5705ecce51ebe637750301fa57e3d1f (patch)
treeed1d18a6539f697fcd18aec6007f5d096628b327 /spec/lib/alaveteli_external_command_spec.rb
parent5a435dfcb699b4f7b7d431cafc479ad92dcd6060 (diff)
Rename spec files so they're run by rake spec.
Diffstat (limited to 'spec/lib/alaveteli_external_command_spec.rb')
-rw-r--r--spec/lib/alaveteli_external_command_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/lib/alaveteli_external_command_spec.rb b/spec/lib/alaveteli_external_command_spec.rb
new file mode 100644
index 000000000..18afeda33
--- /dev/null
+++ b/spec/lib/alaveteli_external_command_spec.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