Class: Minitest::Reporters::AwesomeReporter
- Inherits:
-
HtmlReporter
- Object
- HtmlReporter
- Minitest::Reporters::AwesomeReporter
- Defined in:
- lib/tabbyx/helpers/minitest_helper.rb
Constant Summary collapse
- GRAY =
'0;36'
- GREEN =
'1;32'
- RED =
'1;31'
Instance Method Summary collapse
- #color_up(string, color) ⇒ Object
- #gray(string) ⇒ Object
- #green(string) ⇒ Object
-
#initialize(options = {}) ⇒ AwesomeReporter
constructor
A new instance of AwesomeReporter.
- #record_pass(test) ⇒ Object
- #red(string) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ AwesomeReporter
Returns a new instance of AwesomeReporter.
13 14 15 16 |
# File 'lib/tabbyx/helpers/minitest_helper.rb', line 13 def initialize( = {}) super @slow_threshold = .fetch(:slow_threshold, nil) end |
Instance Method Details
#color_up(string, color) ⇒ Object
26 27 28 |
# File 'lib/tabbyx/helpers/minitest_helper.rb', line 26 def color_up(string, color) color? ? "\e\[#{ color }m#{ string }#{ ANSI::Code::ENDCODE }" : string end |
#gray(string) ⇒ Object
38 39 40 |
# File 'lib/tabbyx/helpers/minitest_helper.rb', line 38 def gray(string) color_up(string, GRAY) end |
#green(string) ⇒ Object
34 35 36 |
# File 'lib/tabbyx/helpers/minitest_helper.rb', line 34 def green(string) color_up(string, GREEN) end |
#record_pass(test) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/tabbyx/helpers/minitest_helper.rb', line 18 def record_pass(test) if @slow_threshold.nil? || test.time <= @slow_threshold super else gray('O') end end |
#red(string) ⇒ Object
30 31 32 |
# File 'lib/tabbyx/helpers/minitest_helper.rb', line 30 def red(string) color_up(string, RED) end |