module MotionSpec::ColorizedOutput

Constants

GREEN
RED
RESET

Public Instance Methods

handle_requirement_begin(description) click to toggle source
# File lib/motion-spec/output/colorized.rb, line 10
def handle_requirement_begin(description); end
handle_requirement_end(error) click to toggle source
# File lib/motion-spec/output/colorized.rb, line 12
def handle_requirement_end(error)
  if error.empty?
    print "#{GREEN}.#{RESET}"
  else
    print "#{RED}#{error[0..0]}#{RESET}"
  end
end
handle_specification_begin(name) click to toggle source
# File lib/motion-spec/output/colorized.rb, line 7
def handle_specification_begin(name); end
handle_specification_end() click to toggle source
# File lib/motion-spec/output/colorized.rb, line 8
def handle_specification_end; end
handle_summary() click to toggle source
# File lib/motion-spec/output/colorized.rb, line 20
def handle_summary
  puts ''
  puts '', ErrorLog  if Backtraces && !ErrorLog.empty?

  duration = '%0.2f' % (Time.now - @timer)
  puts '', "Finished in #{duration} seconds."

  failure = Counter[:errors] > 0 || Counter[:failed] > 0
  color = failure ? RED : GREEN

  puts "#{color}%d tests, %d assertions, %d failures, %d errors#{RESET}" %
    Counter.values_at(:specifications, :requirements, :failed, :errors)
  puts ''
end