Class: Minitest::Reporters::BaseReporter

Inherits:
StatisticsReporter
  • Object
show all
Defined in:
lib/minitest/reporters/base_reporter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ BaseReporter

Returns a new instance of BaseReporter.



16
17
18
19
# File 'lib/minitest/reporters/base_reporter.rb', line 16

def initialize(options = {})
  super($stdout, options)
  self.tests = []
end

Instance Attribute Details

#tests

Returns the value of attribute tests.



14
15
16
# File 'lib/minitest/reporters/base_reporter.rb', line 14

def tests
  @tests
end

Instance Method Details

#add_defaults(defaults)



21
22
23
# File 'lib/minitest/reporters/base_reporter.rb', line 21

def add_defaults(defaults)
  self.options = defaults.merge(options)
end

#after_test(_test)

called by our own after hooks



43
# File 'lib/minitest/reporters/base_reporter.rb', line 43

def after_test(_test); end

#before_test(test)

called by our own before hooks



26
27
28
29
30
31
32
33
34
35
# File 'lib/minitest/reporters/base_reporter.rb', line 26

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)
end

#record(test)



37
38
39
40
# File 'lib/minitest/reporters/base_reporter.rb', line 37

def record(test)
  super
  tests << test
end

#report



45
46
47
48
# File 'lib/minitest/reporters/base_reporter.rb', line 45

def report
  super
  after_suite(test_class(tests.last))
end