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.



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

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

Instance Attribute Details

#tests

Returns the value of attribute tests.



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

def tests
  @tests
end

#total_count=(value)

Sets the attribute total_count

Parameters:

  • value

    the value to set the attribute total_count to.



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

def total_count=(value)
  @total_count = value
end

Instance Method Details

#add_defaults(defaults)



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

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

#after_test(test)

called by our own after hooks



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

def after_test(test)
end

#before_test(test)

called by our own before hooks



17
18
19
20
21
22
23
# File 'lib/minitest/reporters/base_reporter.rb', line 17

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)



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

def record(test)
  super
  tests << test
end

#report



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

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