Class: Minitest::Reporters::SpecReporter

Inherits:
BaseReporter
  • Object
show all
Includes:
Minitest::RelativePosition, ANSI::Code
Defined in:
lib/minitest/reporters/spec_reporter.rb

Overview

Turn-like reporter that reads like a spec.

Based upon TwP's turn (MIT License) and paydro's monkey-patch.

Constant Summary

Constants included from Minitest::RelativePosition

Minitest::RelativePosition::INFO_PADDING, Minitest::RelativePosition::MARK_SIZE, Minitest::RelativePosition::TEST_PADDING, Minitest::RelativePosition::TEST_SIZE

Instance Attribute Summary

Attributes inherited from BaseReporter

#tests

Instance Method Summary collapse

Methods included from ANSI::Code

#black

Methods inherited from BaseReporter

#add_defaults, #after_test, #before_test, #initialize

Constructor Details

This class inherits a constructor from Minitest::Reporters::BaseReporter

Instance Method Details

#record(test)


29
30
31
32
33
34
35
36
37
38
39
# File 'lib/minitest/reporters/spec_reporter.rb', line 29

def record(test)
  super
  print pad_test(test.name)
  print_colored_status(test)
  print(" (%.2fs)" % test.time)
  puts
  if !test.skipped? && test.failure
    print_info(test.failure)
    puts
  end
end

#report


19
20
21
22
23
24
25
26
27
# File 'lib/minitest/reporters/spec_reporter.rb', line 19

def report
  super
  puts('Finished in %.5fs' % total_time)
  print('%d tests, %d assertions, ' % [count, assertions])
  color = failures.zero? && errors.zero? ? :green : :red
  print(send(color) { '%d failures, %d errors, ' } % [failures, errors])
  print(yellow { '%d skips' } % skips)
  puts
end

#start


13
14
15
16
17
# File 'lib/minitest/reporters/spec_reporter.rb', line 13

def start
  super
  puts('Started with run options %s' % options[:args])
  puts
end