class Minitest::Reporters::BaseReporter
Attributes
tests[RW]
Public Class Methods
new(options={})
click to toggle source
Calls superclass method
# File lib/minitest/reporters/base_reporter.rb, line 6 def initialize(options={}) super($stdout, options) self.tests = [] end
Public Instance Methods
add_defaults(defaults)
click to toggle source
# File lib/minitest/reporters/base_reporter.rb, line 11 def add_defaults(defaults) self.options = defaults.merge(options) end
after_test(test)
click to toggle source
called by our own after hooks
# File lib/minitest/reporters/base_reporter.rb, line 30 def after_test(test) end
before_test(test)
click to toggle source
called by our own before hooks
# File lib/minitest/reporters/base_reporter.rb, line 16 def before_test(test) last_test = tests.last if last_test.class != test.class after_suite(last_test.class) if last_test before_suite(test.class) end end
record(test)
click to toggle source
Calls superclass method
# File lib/minitest/reporters/base_reporter.rb, line 24 def record(test) super tests << test end
report()
click to toggle source
Calls superclass method
# File lib/minitest/reporters/base_reporter.rb, line 33 def report super after_suite(tests.last.class) end
Protected Instance Methods
after_suite(test)
click to toggle source
# File lib/minitest/reporters/base_reporter.rb, line 40 def after_suite(test) end
before_suite(test)
click to toggle source
# File lib/minitest/reporters/base_reporter.rb, line 43 def before_suite(test) end
filter_backtrace(backtrace)
click to toggle source
# File lib/minitest/reporters/base_reporter.rb, line 76 def filter_backtrace(backtrace) Minitest.filter_backtrace(backtrace) end
print(*args)
click to toggle source
# File lib/minitest/reporters/base_reporter.rb, line 84 def print(*args) io.print(*args) end
print_colored_status(test)
click to toggle source
# File lib/minitest/reporters/base_reporter.rb, line 58 def print_colored_status(test) if test.passed? print(green { pad_mark( result(test).to_s.upcase ) }) elsif test.skipped? print(yellow { pad_mark( result(test).to_s.upcase ) }) else print(red { pad_mark( result(test).to_s.upcase ) }) end end
print_info(e, name=true)
click to toggle source
# File lib/minitest/reporters/base_reporter.rb, line 88 def print_info(e, name=true) print "#{e.exception.class.to_s}: " if name e.message.each_line { |line| print_with_info_padding(line) } # When e is a Minitest::UnexpectedError, the filtered backtrace is already part of the message printed out # by the previous line. In that case, and that case only, skip the backtrace output. unless e.is_a?(MiniTest::UnexpectedError) trace = filter_backtrace(e.backtrace) trace.each { |line| print_with_info_padding(line) } end end
puts(*args)
click to toggle source
# File lib/minitest/reporters/base_reporter.rb, line 80 def puts(*args) io.puts(*args) end
result(test)
click to toggle source
# File lib/minitest/reporters/base_reporter.rb, line 46 def result(test) if test.error? :error elsif test.skipped? :skip elsif test.failure :fail else :pass end end
total_count()
click to toggle source
# File lib/minitest/reporters/base_reporter.rb, line 72 def total_count options[:total_count] end
total_time()
click to toggle source
Calls superclass method
# File lib/minitest/reporters/base_reporter.rb, line 68 def total_time super || Minitest::Reporters.clock_time - start_time end