Class: Riot::FancyDotReporter
- Inherits:
-
IOReporter
- Object
- IOReporter
- Riot::FancyDotReporter
- Defined in:
- lib/riot-fancydots/fancy_dot_reporter.rb
Instance Method Summary collapse
- #error(description, e) ⇒ Object
- #fail(description, message, line, file) ⇒ Object
-
#initialize(writer = STDOUT) ⇒ FancyDotReporter
constructor
A new instance of FancyDotReporter.
- #pass(description, message) ⇒ Object
- #results(time_taken) ⇒ Object
Constructor Details
#initialize(writer = STDOUT) ⇒ FancyDotReporter
Returns a new instance of FancyDotReporter.
3 4 5 6 7 |
# File 'lib/riot-fancydots/fancy_dot_reporter.rb', line 3 def initialize(writer=STDOUT) super puts "\n" @details = [] end |
Instance Method Details
#error(description, e) ⇒ Object
18 19 20 21 22 |
# File 'lib/riot-fancydots/fancy_dot_reporter.rb', line 18 def error(description, e) print red("E") location = filter_backtrace(e.backtrace).last @details << "#{red bold('ERROR')} #{green dark(line_info(*location.split(':').reverse))} #{test_detail(description, white(dark(format_error e)))}" end |
#fail(description, message, line, file) ⇒ Object
13 14 15 16 |
# File 'lib/riot-fancydots/fancy_dot_reporter.rb', line 13 def fail(description, , line, file) print yellow("F") @details << "#{yellow bold('FAILURE')} #{green dark(line_info(line, file))} #{test_detail(description, )}".strip end |
#pass(description, message) ⇒ Object
9 10 11 |
# File 'lib/riot-fancydots/fancy_dot_reporter.rb', line 9 def pass(description, ) print green(".") end |
#results(time_taken) ⇒ Object
24 25 26 27 |
# File 'lib/riot-fancydots/fancy_dot_reporter.rb', line 24 def results(time_taken) puts "\n\n#{@details.join("\n\n")}" unless @details.empty? super end |