module Cucumber::Formatter::ANSIColor

Defines aliases for coloured output. You don't invoke any methods from this module directly, but you can change the output colours by defining a CUCUMBER_COLORS variable in your shell, very much like how you can tweak the familiar POSIX command ls with <a href="$LSCOLORS/$LS_COLORSmipsisrisc.com/rambling/2008/06/27/lscolorsls_colors-now-with-linux-support/">$LSCOLORS/$LS_COLORS>

The colours that you can change are:

  • undefined - defaults to yellow

  • pending - defaults to yellow

  • pending_param - defaults to yellow,bold

  • failed - defaults to red

  • failed_param - defaults to red,bold

  • passed - defaults to green

  • passed_param - defaults to green,bold

  • outline - defaults to cyan

  • outline_param - defaults to cyan,bold

  • skipped - defaults to cyan

  • skipped_param - defaults to cyan,bold

  • comment - defaults to grey

  • tag - defaults to cyan

For instance, if your shell has a black background and a green font (like the "Homebrew" settings for OS X' Terminal.app), you may want to override passed steps to be white instead of green. Examples:

export CUCUMBER_COLORS="passed=white"
export CUCUMBER_COLORS="passed=white,bold:passed_param=white,bold,underline"

(If you're on Windows, use SET instead of export). To see what colours and effects are available, just run this in your shell:

ruby -e "require 'rubygems'; require 'term/ansicolor'; puts Term::ANSIColor.attributes"

Although not listed, you can also use grey

Constants

ALIASES

Public Instance Methods

cukes(n) click to toggle source
# File lib/cucumber/formatter/ansicolor.rb, line 143
def cukes(n)
  ("(::) " * n).strip
end
green_cukes(n) click to toggle source
# File lib/cucumber/formatter/ansicolor.rb, line 147
def green_cukes(n)
  blink(green(cukes(n)))
end
red_cukes(n) click to toggle source
# File lib/cucumber/formatter/ansicolor.rb, line 151
def red_cukes(n)
  blink(red(cukes(n)))
end
yellow_cukes(n) click to toggle source
# File lib/cucumber/formatter/ansicolor.rb, line 155
def yellow_cukes(n)
  blink(yellow(cukes(n)))
end