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

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.



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

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

Instance Method Details

#context_finished(context) ⇒ Object



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

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



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

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



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

def indent
  INDENT * @current_indent_level
end

#test_finished(test) ⇒ Object



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

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

#test_started(test) ⇒ Object



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

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