Class: MiniTest::Reporters::SpecReporter

Inherits:
Object
  • Object
show all
Includes:
ANSI::Code, MiniTest::Reporter
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 collapse

TEST_PADDING =
2
TEST_SIZE =
63
MARK_SIZE =
5
INFO_PADDING =
8

Instance Method Summary collapse

Methods included from MiniTest::Reporter

#filter_backtrace, #output, #print, #puts, #runner, #verbose?

Instance Method Details

#after_suite(suite)



39
40
41
# File 'lib/minitest/reporters/spec_reporter.rb', line 39

def after_suite(suite)
  puts
end

#after_suites(suites, type)



25
26
27
28
29
30
31
32
33
# File 'lib/minitest/reporters/spec_reporter.rb', line 25

def after_suites(suites, type)
  total_time = Time.now - runner.suites_start_time

  puts('Finished in %.5fs' % total_time)
  print('%d tests, %d assertions, ' % [runner.test_count, runner.assertion_count])
  print(red { '%d failures, %d errors, ' } % [runner.failures, runner.errors])
  print(yellow { '%d skips' } % runner.skips)
  puts
end

#before_suite(suite)



35
36
37
# File 'lib/minitest/reporters/spec_reporter.rb', line 35

def before_suite(suite)
  puts suite.name
end

#before_suites(suites, type)



20
21
22
23
# File 'lib/minitest/reporters/spec_reporter.rb', line 20

def before_suites(suites, type)
  puts 'Started'
  puts
end

#before_test(suite, test)



43
44
45
# File 'lib/minitest/reporters/spec_reporter.rb', line 43

def before_test(suite, test)
  print pad_test(test)
end

#error(suite, test, test_runner)



67
68
69
70
71
72
73
# File 'lib/minitest/reporters/spec_reporter.rb', line 67

def error(suite, test, test_runner)
  print(red { pad_mark('ERROR') })
  print_time(test)
  puts
  print_info(test_runner.exception)
  puts
end

#failure(suite, test, test_runner)



59
60
61
62
63
64
65
# File 'lib/minitest/reporters/spec_reporter.rb', line 59

def failure(suite, test, test_runner)
  print(red { pad_mark('FAIL') })
  print_time(test)
  puts
  print_info(test_runner.exception)
  puts
end

#pass(suite, test, test_runner)



47
48
49
50
51
# File 'lib/minitest/reporters/spec_reporter.rb', line 47

def pass(suite, test, test_runner)
  print(green { pad_mark('PASS') })
  print_time(test)
  puts
end

#skip(suite, test, test_runner)



53
54
55
56
57
# File 'lib/minitest/reporters/spec_reporter.rb', line 53

def skip(suite, test, test_runner)
  print(yellow { pad_mark('SKIP') })
  print_time(test)
  puts
end