Module: MotionSpec::ColorizedOutput

Defined in:
lib/motion-spec/output/colorized.rb

Constant Summary collapse

GREEN =
"\033[0;32m"
RED =
"\033[0;31m"
RESET =
"\033[00m"

Instance Method Summary collapse

Instance Method Details

#handle_requirement_begin(description) ⇒ Object



11
# File 'lib/motion-spec/output/colorized.rb', line 11

def handle_requirement_begin(description); end

#handle_requirement_end(error) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/motion-spec/output/colorized.rb', line 13

def handle_requirement_end(error)
  if error.empty?
    print "#{GREEN}.#{RESET}"
  else
    print "#{RED}#{error[0..0]}#{RESET}"
  end
end

#handle_specification_begin(name) ⇒ Object



8
# File 'lib/motion-spec/output/colorized.rb', line 8

def handle_specification_begin(name); end

#handle_specification_endObject



9
# File 'lib/motion-spec/output/colorized.rb', line 9

def handle_specification_end; end

#handle_summaryObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/motion-spec/output/colorized.rb', line 21

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