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, #enter_scope, #exit_all, #exit_scope, #initialize

Methods inherited from Reporter

#counts, #enter_all, #enter_scope, #exit_all, #exit_scope

Constructor Details

This class inherits a constructor from Oktest::BaseReporter

Instance Method Details

#enter_spec(spec, depth) ⇒ Object



1594
1595
1596
1597
1598
1599
1600
# File 'lib/oktest.rb', line 1594

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



1585
1586
1587
1588
# File 'lib/oktest.rb', line 1585

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

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



1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
# File 'lib/oktest.rb', line 1602

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
end

#exit_topic(topic, depth) ⇒ Object



1590
1591
1592
# File 'lib/oktest.rb', line 1590

def exit_topic(topic, depth)
  print_exceptions()
end