Module: ThoughtBot::Shoulda::Color

Defined in:
lib/shoulda/color.rb

Overview

Completely stolen from redgreen gem

Adds colored output to your tests. Specify color: true in your ~/.shoulda.conf file to enable.

Bug: for some reason, this adds another line of output to the end of every rake task, as though there was another (empty) set of tests.

A fix would be most welcome.

Constant Summary collapse

COLORS =

:nodoc:

{ :clear => 0, :red => 31, :green => 32, :yellow => 33 }

Class Method Summary collapse

Class Method Details

.color(color) ⇒ Object

:nodoc:



17
18
19
# File 'lib/shoulda/color.rb', line 17

def self.color(color) # :nodoc:
  "\e[#{COLORS[color.to_sym]}m"
end

.method_missing(color_name, *args) ⇒ Object

:nodoc:



14
15
16
# File 'lib/shoulda/color.rb', line 14

def self.method_missing(color_name, *args)  # :nodoc:
  color(color_name) + args.first + color(:clear) 
end