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.


28
29
30
31
# File 'lib/minitest/reporters/base_reporter.rb', line 28

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

Instance Attribute Details

#tests

Returns the value of attribute tests


26
27
28
# File 'lib/minitest/reporters/base_reporter.rb', line 26

def tests
  @tests
end

Instance Method Details

#add_defaults(defaults)


33
34
35
# File 'lib/minitest/reporters/base_reporter.rb', line 33

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

#after_test(_test)

called by our own after hooks


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

def after_test(_test); end

#before_test(test)

called by our own before hooks


38
39
40
41
42
43
44
45
46
47
# 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)


49
50
51
52
# File 'lib/minitest/reporters/base_reporter.rb', line 49

def record(test)
  super
  tests << test
end

#report


57
58
59
60
61
62
# File 'lib/minitest/reporters/base_reporter.rb', line 57

def report
  super
  if last_suite = test_class(tests.last)
    after_suite(last_suite)
  end
end