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.



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

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

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

  @current_group = nil
  @current_example = nil
end

Instance Method Details

#before_test(test) ⇒ Object



23
24
25
# File 'lib/test_prof/event_prof/minitest.rb', line 23

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

#prerecord(group, example) ⇒ Object



18
19
20
21
# File 'lib/test_prof/event_prof/minitest.rb', line 18

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

#record ⇒ Object



27
28
29
# File 'lib/test_prof/event_prof/minitest.rb', line 27

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

#report ⇒ Object



31
32
33
34
# File 'lib/test_prof/event_prof/minitest.rb', line 31

def report
  @profiler.group_finished(@current_group)
  ::TestProf::EventProf.config.printer.dump(@profiler)
end