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.



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

def add_defaults(defaults); end

#after_test(test) ⇒ Object



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

def after_test(test); end

#before_test(test) ⇒ Object



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

def before_test(test); end

#record(result) ⇒ Object



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

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
# File 'lib/minitest/slow_test/reporter.rb', line 11

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