Class: Minitest::Reporters::TurnReporter

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

Overview

Turn-like reporter that reads like a spec.

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

Instance Method Summary collapse

Instance Method Details



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/minitest/reporters/turn_reporter.rb', line 58

def print_colored_status(test)
  if test.passed?
    print(green { pad_mark( result(test).to_s.upcase ) })
  elsif test.skipped?
    print(cyan { pad_mark( result(test).to_s.upcase ) })
  elsif test.error?
    print(yellow { pad_mark( result(test).to_s.upcase ) })
  else
    print(red { pad_mark( result(test).to_s.upcase ) })
  end
end

#record(test) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/minitest/reporters/turn_reporter.rb', line 45

def record(test)
  super
  print "    "
  print_colored_status(test)
  print(" (%.2fs) " % test.time)
  print test.name.gsub(/^test_: /, "")
  puts
  if !test.skipped? && test.failure
    print_info(test.failure)
    puts
  end
end

#reportObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/minitest/reporters/turn_reporter.rb', line 23

def report
  super
  puts
  puts "To run the test suite again with the same options use:"
  puts
  puts "  rake test TESTOPTS=\"#{options[:args]}\""
  puts
  puts "Finished in %.5fs" % total_time
  print "\e[37m%d tests\e[0m" % count
  print ", "
  print_with_color :green, "%d passed", passes
  print ", "
  print_with_color :red, "%d failures", failures
  print ", "
  print_with_color :yellow, "%d errors", errors
  print ", "
  print_with_color :cyan, "%d skips", skips
  print ", "
  print "%d assertions" % assertions
  puts
end

#startObject



17
18
19
20
21
# File 'lib/minitest/reporters/turn_reporter.rb', line 17

def start
  super
  puts "Run Options: #{options[:args]}"
  puts
end