Class: Journo::Reporters::SpecReporter

Inherits:
Journo::Reporter show all
Includes:
ANSI::Code
Defined in:
lib/journo/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
INFO_PADDING =
8
MARK_SIZE =
5

Constants inherited from Journo::Reporter

Journo::Reporter::VERSION

Instance Method Summary collapse

Methods inherited from Journo::Reporter

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

Instance Method Details

#after_suite(suite)



37
38
39
# File 'lib/journo/reporters/spec_reporter.rb', line 37

def after_suite(suite)
  puts
end

#after_suites(suites, type)



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

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)



33
34
35
# File 'lib/journo/reporters/spec_reporter.rb', line 33

def before_suite(suite)
  puts suite
end

#before_suites(suites, type)



18
19
20
21
# File 'lib/journo/reporters/spec_reporter.rb', line 18

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

#error(suite, test, test_runner)



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

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)



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

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)



41
42
43
44
45
# File 'lib/journo/reporters/spec_reporter.rb', line 41

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

#skip(suite, test, test_runner)



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

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