Module: MiniTest::Display
- Defined in:
- lib/minitest/display.rb
Constant Summary collapse
- VERSION =
'0.0.4'
- DONT_PRINT_CLASSES =
%w{ ActionDispatch::IntegrationTest ActionController::IntegrationTest ActionController::TestCase ActionMailer::TestCase ActionView::TestCase ActiveRecord::TestCase ActiveSupport::TestCase Test::Unit::TestCase MiniTest::Unit::TestCase MiniTest::Spec}
Class Method Summary collapse
- .color(string, color) ⇒ Object
- .options ⇒ Object
- .options=(new_options) ⇒ Object
- .printable_suite?(suite) ⇒ Boolean
- .tint(color) ⇒ Object
Class Method Details
.color(string, color) ⇒ Object
80 81 82 83 |
# File 'lib/minitest/display.rb', line 80 def color(string, color) return string unless STDOUT.tty? && [:color] tint(color) + string + tint(:clear) end |
.options ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/minitest/display.rb', line 24 def @options ||= { suite_names: true, suite_divider: " | ", suite_time: true, color: true, wrap_at: 80, output_slow: 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) ⇒ Object
76 77 78 |
# File 'lib/minitest/display.rb', line 76 def () self..deep_merge!() end |
.printable_suite?(suite) ⇒ Boolean
110 111 112 |
# File 'lib/minitest/display.rb', line 110 def printable_suite?(suite) !DONT_PRINT_CLASSES.include?(suite.to_s) end |
.tint(color) ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/minitest/display.rb', line 85 def tint(color) case color when Array color.collect {|c| tint(c) }.join('') when Symbol if c = [:colors][color] tint(c) end else "\e[#{color}m" end end |