Class: Minitest::DocReporter::DocReporter

Inherits:
AbstractReporter
  • Object
show all
Includes:
ANSI::Code
Defined in:
lib/minitest/doc_reporter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ DocReporter

Returns a new instance of DocReporter.



17
18
19
20
21
22
23
24
25
# File 'lib/minitest/doc_reporter.rb', line 17

def initialize(options = {})
  @io = io
  @options = options
  self.results = []
  self.errors = 0
  self.skips = 0
  self.count = 0
  self.failures = 0
end

Instance Attribute Details

#countObject

Returns the value of attribute count.



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

def count
  @count
end

#errorsObject

Returns the value of attribute errors.



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

def errors
  @errors
end

#failuresObject

Returns the value of attribute failures.



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

def failures
  @failures
end

#ioObject (readonly)

Returns the value of attribute io.



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

def io
  @io
end

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

#resultsObject

Returns the value of attribute results.



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

def results
  @results
end

#skipsObject

Returns the value of attribute skips.



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

def skips
  @skips
end

#start_timeObject

Returns the value of attribute start_time.



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

def start_time
  @start_time
end

#total_time=(value) ⇒ Object

Sets the attribute total_time

Parameters:

  • value

    the value to set the attribute total_time to.



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

def total_time=(value)
  @total_time = value
end

Instance Method Details

#record(result) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/minitest/doc_reporter.rb', line 32

def record(result)
  puts format_header(result)
  puts format_result(result)
  puts

  puts failure_info(result) unless result.passed?

  update_statistics(result)
end

#reportObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/minitest/doc_reporter.rb', line 43

def report
  super

  aggregate = self.results.group_by { |r| r.failure.class }
  aggregate.default = [] # dumb. group_by should provide this

  self.failures   = aggregate[Assertion].size
  self.errors     = aggregate[UnexpectedError].size
  self.skips      = aggregate[Skip].size

  puts
  puts format_tests_run_count(count, total_time)
  puts statistics
  puts
end

#startObject



27
28
29
30
# File 'lib/minitest/doc_reporter.rb', line 27

def start
  puts
  self.start_time = Time.now
end