Class: Oktest::VerboseReporter

Inherits:
BaseReporter show all
Defined in:
lib/oktest.rb

Constant Summary collapse

LABELS =

; [!6o9nw] reports topic name and spec desc.

{ :PASS=>'pass', :FAIL=>'Fail', :ERROR=>'ERROR', :SKIP=>'Skip', :TODO=>'TODO' }

Constants inherited from BaseReporter

BaseReporter::CHARS

Instance Attribute Summary

Attributes inherited from BaseReporter

#counts

Instance Method Summary collapse

Methods inherited from BaseReporter

#enter_all, #exit_all, #initialize

Methods inherited from Reporter

#counts, #enter_all, #exit_all, #order_policy

Constructor Details

This class inherits a constructor from Oktest::BaseReporter

Instance Method Details

#enter_scope(scope) ⇒ Object



2024
2025
2026
# File 'lib/oktest.rb', line 2024

def enter_scope(scope)
  puts "## #{scope.filename}"
end

#enter_spec(spec, depth) ⇒ Object



2043
2044
2045
2046
2047
2048
2049
# File 'lib/oktest.rb', line 2043

def enter_spec(spec, depth)
  if $stdout.tty?
    str = "#{'  ' * (depth - 1)}#{spec._prefix} [    ] #{spec.desc}"
    print Util.strfold(str, 79)
    $stdout.flush
  end
end

#enter_topic(topic, depth) ⇒ Object



2034
2035
2036
2037
# File 'lib/oktest.rb', line 2034

def enter_topic(topic, depth)
  super
  puts "#{'  ' * (depth - 1)}#{topic._prefix} #{Color.topic(topic.target)}"
end

#exit_scope(scope) ⇒ Object



2028
2029
2030
2031
2032
# File 'lib/oktest.rb', line 2028

def exit_scope(scope)
  #; [!ibdu7] reports errors even when no topics.
  super
  print_exceptions()
end

#exit_spec(spec, depth, status, error, parent) ⇒ Object



2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
# File 'lib/oktest.rb', line 2051

def exit_spec(spec, depth, status, error, parent)
  super
  if $stdout.tty?
    print "\r"    # clear line
    $stdout.flush
  end
  label = Color.status(status, LABELS[status] || '???')
  msg = ["#{'  ' * (depth - 1)}- [#{label}] #{spec.desc}"]
  msg << " " << Color.reason("(reason: #{error.message})") if status == :SKIP
  puts msg.join()
end

#exit_topic(topic, depth) ⇒ Object



2039
2040
2041
# File 'lib/oktest.rb', line 2039

def exit_topic(topic, depth)
  print_exceptions()
end