module Minitest::Display

Constants

DONT_PRINT_CLASSES
VERSION

Public Class Methods

add_recorder(new_recorder) click to toggle source

Add a recorder which for each test that has a `record`. Optionally can also have an:

`record_tests_started`, `record_suite_started(suite)`, `record(suite, method, assertions, time, error)` `record_suite_finished(suite, assertions, time)`, `record_tests_finished(test_count, assertion_count, failure_count, error_count, time)

(Executed in that order)

# File lib/minitest/display.rb, line 128
def add_recorder(new_recorder)
  new_recorder_instance = new_recorder.new(self)
  @recorders ||= []
  @recorders << new_recorder_instance
end
color(string, color) click to toggle source
# File lib/minitest/display.rb, line 83
def color(string, color)
  return string unless STDOUT.tty? && options[:color]
  tint(color) + string + tint(:clear)
end
options() click to toggle source
# File lib/minitest/display.rb, line 26
def options
  @options ||= {
    :suite_names => true,
    :suite_divider => " | ",
    :suite_time => true,
    :color => true,
    :wrap_at => 80,
    :output_slow => 5,
    :output_slow_suites => 5,
    :print => {
      :success => '.',
      :failure => 'F',
      :error => 'E'
    },
    :colors => {
      :clear => 0,
      :bold => 1,
      :italics => 3,
      :underline => 4,
      :inverse => 9,
      :strikethrough => 22,
      :bold_off => 23,
      :italics_off => 24,
      :underline_off => 27,
      :inverse_off => 29,
      :strikethrough_off => 30,
      :black => 30,
      :red => 31,
      :green => 32,
      :yellow => 33,
      :blue => 34,
      :magenta => 35,
      :cyan => 36,
      :white => 37,
      :default => 39,
      :bg_black => 40,
      :bg_red => 41,
      :bg_green => 42,
      :bg_yellow => 43,
      :bg_blue => 44,
      :bg_magenta => 45,
      :bg_cyan => 46,
      :bg_white => 47,
      :bg_default => 49,

      :suite => :clear,
      :success => :green,
      :failure => :red,
      :error => :yellow
    }
  }
end
options=(new_options) click to toggle source
# File lib/minitest/display.rb, line 79
def options=(new_options)
  self.options.deep_merge!(new_options)
end
printable_suite?(suite) click to toggle source
# File lib/minitest/display.rb, line 113
def printable_suite?(suite)
  !DONT_PRINT_CLASSES.include?(suite.to_s)
end
recorders() click to toggle source

An array of all the registered MiniTest::Display recorders

# File lib/minitest/display.rb, line 135
def recorders
  @recorders || []
end
tint(color) click to toggle source
# File lib/minitest/display.rb, line 88
def tint(color)
  case color
  when Array
    color.collect {|c| tint(c) }.join('')
  when Symbol
    if c = options[:colors][color]
      tint(c)
    end
  else
    "\e[#{color}m"
  end
end