Class: Minitest::SlowTest::Reporter

Inherits:
StatisticsReporter
  • Object
show all
Defined in:
lib/minitest/slow_test/reporter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Reporter.



6
7
8
9
# File 'lib/minitest/slow_test/reporter.rb', line 6

def initialize(io = $stdout, options = {})
  super(io, options)
  @slow_test_list = []
end

Instance Attribute Details

#slow_test_listObject (readonly)

Returns the value of attribute slow_test_list.



4
5
6
# File 'lib/minitest/slow_test/reporter.rb', line 4

def slow_test_list
  @slow_test_list
end

Instance Method Details

#add_defaults(defaults) ⇒ Object

When using the following methods together with ‘minitest-reporters`, they are required.



27
# File 'lib/minitest/slow_test/reporter.rb', line 27

def add_defaults(defaults); end

#after_test(test) ⇒ Object



31
# File 'lib/minitest/slow_test/reporter.rb', line 31

def after_test(test); end

#before_test(test) ⇒ Object



29
# File 'lib/minitest/slow_test/reporter.rb', line 29

def before_test(test); end

#record(result) ⇒ Object



19
20
21
22
23
# File 'lib/minitest/slow_test/reporter.rb', line 19

def record(result)
  if result.time.to_f > SlowTest.long_test_time && !SlowTest.exclude_test_name.include?(result.name.to_s)
    @slow_test_list << result
  end
end

#reportObject



11
12
13
14
15
16
17
# File 'lib/minitest/slow_test/reporter.rb', line 11

def report
  super
  @slow_test_list.each do |slow_test|
    klass = slow_test.respond_to?(:klass) ? slow_test.klass : slow_test.class
    io.print "[SlowTest] %s#%s : %.2fs\n" % [klass, slow_test.name, slow_test.time]
  end
end