From 5810bf7599652df36ccbb882c6abc06bf42caace Mon Sep 17 00:00:00 2001 From: Marin Usalj Date: Wed, 13 Jun 2012 14:02:17 +0200 Subject: [PATCH] Added the FastOutput! Fixed Knock and Tap spec names that were not displayed --- lib/motion/spec.rb | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/lib/motion/spec.rb b/lib/motion/spec.rb index c2b14192..d7ce6dce 100644 --- a/lib/motion/spec.rb +++ b/lib/motion/spec.rb @@ -71,20 +71,39 @@ module Bacon end end + module FastOutput + def handle_specification_begin(name); end + def handle_specification_end; end + + def handle_requirement_begin(description); end + def handle_requirement_end(error) + return if error.empty? + print error[0..0] + end + + def handle_summary + puts "", "Finished in #{Time.now - @timer} seconds." + puts ErrorLog if Backtraces + puts "%d tests, %d assertions, %d failures, %d errors" % + Counter.values_at(:specifications, :requirements, :failed, :errors) + end + end + module TapOutput def handle_specification_begin(name); end def handle_specification_end ; end def handle_requirement_begin(description) + @description = description ErrorLog.replace "" end def handle_requirement_end(error) if error.empty? - puts "ok %-3d - %s" % [Counter[:specifications], description] + puts "ok %-3d - %s" % [Counter[:specifications], @description] else puts "not ok %d - %s: %s" % - [Counter[:specifications], description, error] + [Counter[:specifications], @description, error] puts ErrorLog.strip.gsub(/^/, '# ') if Backtraces end end @@ -101,14 +120,15 @@ module Bacon def handle_specification_end ; end def handle_requirement_begin(description) + @description = description ErrorLog.replace "" end def handle_requirement_end(error) if error.empty? - puts "ok - %s" % [description] + puts "ok - %s" % [@description] else - puts "not ok - %s: %s" % [description, error] + puts "not ok - %s: %s" % [@description, error] puts ErrorLog.strip.gsub(/^/, '# ') if Backtraces end end @@ -119,6 +139,8 @@ module Bacon extend case ENV['output'] when nil, 'spec_dox' SpecDoxOutput # default + when 'fast' + FastOutput when 'test_unit' TestUnitOutput when 'tap'