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

Methods inherited from Reporter

#counts, #enter_all, #exit_all, #exit_scope, #order_policy

Constructor Details

This class inherits a constructor from Oktest::BaseReporter

Instance Method Details

#enter_scope(scope) ⇒ Object



1887
1888
1889
# File 'lib/oktest.rb', line 1887

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

#enter_spec(spec, depth) ⇒ Object



1900
1901
1902
1903
1904
1905
1906
# File 'lib/oktest.rb', line 1900

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



1891
1892
1893
1894
# File 'lib/oktest.rb', line 1891

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

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



1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
# File 'lib/oktest.rb', line 1908

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



1896
1897
1898
# File 'lib/oktest.rb', line 1896

def exit_topic(topic, depth)
  print_exceptions()
end