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.

See Also:

Constant Summary

TEST_PADDING =
2
INFO_PADDING =
8
MARK_SIZE =
5

Instance Method Summary (collapse)

Methods included from MiniTest::Reporter

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

Instance Method Details

- after_suite(suite)



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

def after_suite(suite)
  puts
end

- after_suites(suites, type)



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

def after_suites(suites, type)
  total_time = Time.now - runner.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)



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

def before_suite(suite)
  puts suite
end

- before_suites(suites, type)



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

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

- error(suite, test, test_runner)



62
63
64
65
66
67
68
# File 'lib/minitest/reporters/spec_reporter.rb', line 62

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

- failure(suite, test, test_runner)



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

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

- pass(suite, test, test_runner)



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

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

- skip(suite, test, test_runner)



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

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