]> git.wincent.com - wikitext.git/commitdiff
Spew diagnostic text to console in the event of an error
authorWincent Colaiuta <win@wincent.com>
Mon, 5 Jan 2009 17:01:38 +0000 (18:01 +0100)
committerWincent Colaiuta <win@wincent.com>
Mon, 5 Jan 2009 17:25:13 +0000 (18:25 +0100)
We want the Rails tests to be totally silent, but only when things
actually work. In the contrary case we spew everything to the console
for diagnostic purposes.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
spec/rails_spec.rb

index df53d9c060b8d05cca1125f194e6726c6ca286c0..b21ad9f5d05366c086e2f074bdec94c6c54fc312 100644 (file)
@@ -40,7 +40,14 @@ module RailsSpecs
       end
       threads.each { |thread| thread.join }
     end
-    result.status = $?.exitstatus
+    status = $?.exitstatus
+    if status != 0
+      command_string = ([cmd] + args).join(' ')
+      puts "*** COMMAND #{command_string} EXITED WITH NON-ZERO EXIT STATUS (#{status})"
+      puts "*** STDOUT FOR COMMAND #{command_string}:", result.stdout
+      puts "*** STDERR FOR COMMAND #{command_string}:", result.stderr
+      raise "non-zero exit status (#{status}) for '#{cmd}'"
+    end
     result
   end