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



1912
1913
1914
# File 'lib/oktest.rb', line 1912

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

#enter_spec(spec, depth) ⇒ Object



1931
1932
1933
1934
1935
1936
1937
# File 'lib/oktest.rb', line 1931

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



1922
1923
1924
1925
# File 'lib/oktest.rb', line 1922

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

#exit_scope(scope) ⇒ Object



1916
1917
1918
1919
1920
# File 'lib/oktest.rb', line 1916

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

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



1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
# File 'lib/oktest.rb', line 1939

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



1927
1928
1929
# File 'lib/oktest.rb', line 1927

def exit_topic(topic, depth)
  print_exceptions()
end