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 28
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 33
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 55
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 38
def before_test(test)
  last_test = test_class(tests.last)

  suite_changed = last_test.nil? || last_test.name != test.class.name

  return unless suite_changed

  after_suite(last_test) if last_test
  before_suite(test_class(test))
end
record(test) click to toggle source
Calls superclass method
# File lib/minitest/reporters/base_reporter.rb, line 49
def record(test)
  super
  tests << test
end
report() click to toggle source
Calls superclass method
# File lib/minitest/reporters/base_reporter.rb, line 57
def report
  super
  after_suite(test_class(tests.last))
end

Protected Instance Methods

after_suite(test) click to toggle source
# File lib/minitest/reporters/base_reporter.rb, line 64
def after_suite(test); end
before_suite(test) click to toggle source
# File lib/minitest/reporters/base_reporter.rb, line 66
def before_suite(test); end
filter_backtrace(backtrace) click to toggle source
# File lib/minitest/reporters/base_reporter.rb, line 109
def filter_backtrace(backtrace)
  Minitest.filter_backtrace(backtrace)
end
print(*args) click to toggle source
print_colored_status(test) click to toggle source
print_info(e, name = true) click to toggle source
puts(*args) click to toggle source
# File lib/minitest/reporters/base_reporter.rb, line 113
def puts(*args)
  io.puts(*args)
end
result(test) click to toggle source
# File lib/minitest/reporters/base_reporter.rb, line 68
def result(test)
  if test.error?
    :error
  elsif test.skipped?
    :skip
  elsif test.failure
    :fail
  else
    :pass
  end
end
test_class(result) click to toggle source
# File lib/minitest/reporters/base_reporter.rb, line 80
def test_class(result)
  # Minitest broke API between 5.10 and 5.11 this gets around Result object
  if result.nil?
    nil
  elsif result.respond_to? :klass
    Suite.new(result.klass)
  else
    Suite.new(result.class.name)
  end
end
total_count() click to toggle source
# File lib/minitest/reporters/base_reporter.rb, line 105
def total_count
  options[:total_count]
end
total_time() click to toggle source
Calls superclass method
# File lib/minitest/reporters/base_reporter.rb, line 101
def total_time
  super || Minitest::Reporters.clock_time - start_time
end