Class: Riot::IOReporter
Overview
Reporter
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Reporter
#current_context, #errors, #failures, #passes
Instance Method Summary collapse
- #format_error(e) ⇒ Object
-
#initialize(writer = STDOUT) ⇒ IOReporter
constructor
A new instance of IOReporter.
- #print(message) ⇒ Object
- #puts(message) ⇒ Object
- #results(time_taken) ⇒ Object
Methods inherited from Reporter
#describe_context, #new, #report, #success?, #summarize
Constructor Details
#initialize(writer = STDOUT) ⇒ IOReporter
Returns a new instance of IOReporter.
40 41 42 43 |
# File 'lib/riot/reporter.rb', line 40 def initialize(writer=STDOUT) super() @writer = writer end |
Instance Method Details
#format_error(e) ⇒ Object
52 53 54 55 56 57 58 59 |
# File 'lib/riot/reporter.rb', line 52 def format_error(e) format = [] format << " #{e.class.name} occurred" format << "#{e.to_s}" e.backtrace.each { |line| format << " at #{line}" } format.join("\n") end |
#print(message) ⇒ Object
45 |
# File 'lib/riot/reporter.rb', line 45 def print() @writer.print(); end |
#puts(message) ⇒ Object
44 |
# File 'lib/riot/reporter.rb', line 44 def puts() @writer.puts(); end |
#results(time_taken) ⇒ Object
47 48 49 50 |
# File 'lib/riot/reporter.rb', line 47 def results(time_taken) values = [passes, failures, errors, ("%0.6f" % time_taken)] puts "\n%d passes, %d failures, %d errors in %s seconds" % values end |