Permalink
Browse files

[Specs] Facelift inspired to xctool

  • Loading branch information...
1 parent 02c3794 commit 98fc47762827aa5735ef193d888401b6d8af8039 @fabiopelosin fabiopelosin committed May 9, 2013
Showing with 8 additions and 2 deletions.
  1. +8 −2 spec/spec_helper/bacon.rb
View
10 spec/spec_helper/bacon.rb
@@ -1,3 +1,5 @@
+# Encoding: utf-8
+
module Bacon
summary_at_exit
@@ -11,8 +13,9 @@ def self.color(color, string)
"\e[32m#{string}\e[0m"
when :yellow
"\e[33m#{string}\e[0m"
+ when :none
+ string
else
- # Support for Conque
"\e[0m#{string}\e[0m"
end
end
@@ -43,14 +46,17 @@ def handle_specification(name)
#:nodoc:
def handle_requirement(description, disabled = false)
+ start_time = Time.now.to_f
error = yield
+ elapsed_time = ((Time.now.to_f - start_time) * 1000).round
if !error.empty?
puts Bacon.color(:red, "#{spaces}- #{description} [FAILED]")
elsif disabled
puts Bacon.color(:yellow, "#{spaces}- #{description} [DISABLED]")
else
- puts Bacon.color(:green, "#{spaces}- #{description}")
+ time_color = elapsed_time > 200 ? :yellow : :none
+ puts Bacon.color(:green, "#{spaces}") + "#{description} " + Bacon.color(time_color, "(#{elapsed_time} ms)")
end
end

0 comments on commit 98fc477

Please sign in to comment.