Class: Minitest::TestProf::EventProfReporter

Inherits:
BaseReporter
  • Object
show all
Defined in:
lib/test_prof/event_prof/minitest.rb

Overview

:nodoc:

Constant Summary

Constants included from TestProf::Logging

TestProf::Logging::COLORS

Instance Attribute Summary

Attributes inherited from BaseReporter

#io

Instance Method Summary collapse

Methods inherited from BaseReporter

#after_test, #start

Methods included from TestProf::Logging

#log

Constructor Details

#initialize(io = $stdout, options = {}) ⇒ EventProfReporter

Returns a new instance of EventProfReporter.



9
10
11
12
13
14
15
16
17
18
# File 'lib/test_prof/event_prof/minitest.rb', line 9

def initialize(io = $stdout, options = {})
  super
  @profiler = configure_profiler(options)

  log :info, "EventProf enabled (#{@profiler.events.join(", ")})"

  @formatter = EventProfFormatter.new(@profiler)
  @current_group = nil
  @current_example = nil
end

Instance Method Details

#before_test(test) ⇒ Object



25
26
27
# File 'lib/test_prof/event_prof/minitest.rb', line 25

def before_test(test)
  prerecord(test.class, test.name)
end

#prerecord(group, example) ⇒ Object



20
21
22
23
# File 'lib/test_prof/event_prof/minitest.rb', line 20

def prerecord(group, example)
  change_current_group(group, example) unless @current_group
  track_current_example(group, example)
end

#recordObject



29
30
31
# File 'lib/test_prof/event_prof/minitest.rb', line 29

def record(*)
  @profiler.example_finished(@current_example)
end

#reportObject



33
34
35
36
37
# File 'lib/test_prof/event_prof/minitest.rb', line 33

def report
  @profiler.group_finished(@current_group)
  result = @formatter.prepare_results
  log :info, result
end