Class: Minitest::SlowTest::Reporter
- Inherits:
-
StatisticsReporter
- Object
- StatisticsReporter
- Minitest::SlowTest::Reporter
- Defined in:
- lib/minitest/slow_test/reporter.rb
Instance Attribute Summary collapse
-
#slow_test_list ⇒ Object
readonly
Returns the value of attribute slow_test_list.
Instance Method Summary collapse
-
#add_defaults(defaults) ⇒ Object
When using the following methods together with ‘minitest-reporters`, they are required.
- #after_test(test) ⇒ Object
- #before_test(test) ⇒ Object
-
#initialize(io = $stdout, options = {}) ⇒ Reporter
constructor
A new instance of Reporter.
- #record(result) ⇒ Object
- #report ⇒ Object
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, = {}) super(io, ) @slow_test_list = [] end |
Instance Attribute Details
#slow_test_list ⇒ Object (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 |
#report ⇒ Object
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 |