Class: Kintama::Reporter::Verbose

Inherits:
Base
  • Object
show all
Defined in:
lib/kintama/reporter.rb

Constant Summary collapse

INDENT =
"  "

Instance Attribute Summary

Attributes inherited from Base

#runner, #test_count

Instance Method Summary collapse

Methods inherited from Base

#character_status_of, #failure_messages, #finished, #show_results, #started, #test_summary

Constructor Details

#initialize(colour = false) ⇒ Verbose

Returns a new instance of Verbose.



93
94
95
96
97
# File 'lib/kintama/reporter.rb', line 93

def initialize(colour=false)
  super()
  @colour = colour
  @current_indent_level = 0
end

Instance Method Details

#context_finished(context) ⇒ Object



110
111
112
113
114
115
# File 'lib/kintama/reporter.rb', line 110

def context_finished(context)
  unless context == Kintama.default_context || context.name == nil
    @current_indent_level -= 1
    puts if @current_indent_level == 0 && context != runner.runnables.last
  end
end

#context_started(context) ⇒ Object



103
104
105
106
107
108
# File 'lib/kintama/reporter.rb', line 103

def context_started(context)
  unless context == Kintama.default_context || context.name == nil
    print indent + context.name + "\n" if context.name
    @current_indent_level += 1
  end
end

#indentObject



99
100
101
# File 'lib/kintama/reporter.rb', line 99

def indent
  INDENT * @current_indent_level
end

#test_finished(test) ⇒ Object



122
123
124
125
126
127
128
# File 'lib/kintama/reporter.rb', line 122

def test_finished(test)
  if @colour
    puts coloured_name(test)
  else
    puts character_status_of(test)
  end
end

#test_started(test) ⇒ Object



117
118
119
120
# File 'lib/kintama/reporter.rb', line 117

def test_started(test)
  super
  print indent + test.name + ": " unless @colour
end