Class: Test::Reporters::Summary

Inherits:
Dotprogress show all
Defined in:
lib/rubytest/format/summary.rb

Overview

One status line per result, followed by failure details and totals.

Constant Summary collapse

LABELS =
{
  pass: 'PASS', fail: 'FAIL', error: 'ERROR',
  todo: 'TODO', skip: 'SKIP'
}.freeze

Instance Attribute Summary

Attributes inherited from Abstract

#runner

Instance Method Summary collapse

Methods inherited from Dotprogress

#end_suite, #error, #fail, #finish, #initialize, #pass, #skip_case, #skip_test, #todo

Methods inherited from Abstract

#begin_test, #end_test, inherited, #initialize, registry

Constructor Details

This class inherits a constructor from Test::Reporters::Dotprogress

Instance Method Details

#begin_case(test_case) ⇒ Object



15
16
17
# File 'lib/rubytest/format/summary.rb', line 15

def begin_case(test_case)
  @case_path << test_case.to_s.lines.first.to_s.strip
end

#begin_suite(suite) ⇒ Object



11
12
13
# File 'lib/rubytest/format/summary.rb', line 11

def begin_suite(suite)
  @case_path = []
end

#end_case(test_case) ⇒ Object



19
20
21
# File 'lib/rubytest/format/summary.rb', line 19

def end_case(test_case)
  @case_path.pop
end

#record(result) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/rubytest/format/summary.rb', line 23

def record(result)
  label = result.test.to_s.lines.first.to_s.strip
  path = @case_path.dup
  path.pop if result.kind == :case && path.last == label
  path << label unless label.empty?
  @output.puts "#{LABELS.fetch(result.status).ljust(5)} #{path.join('  ')}"
end