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


6
7
8
9
# File 'lib/minitest/reporters/base_reporter.rb', line 6

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

Instance Attribute Details

#tests

Returns the value of attribute tests


4
5
6
# File 'lib/minitest/reporters/base_reporter.rb', line 4

def tests
  @tests
end

Instance Method Details

#add_defaults(defaults)


11
12
13
# File 'lib/minitest/reporters/base_reporter.rb', line 11

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

#after_test(test)

called by our own after hooks


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

def after_test(test)
end

#before_test(test)

called by our own before hooks


16
17
18
19
20
21
22
# 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)


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

def record(test)
  super
  tests << test
end

#report


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

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