Module: Bacon::ColorOutput

Included in:
Bacon
Defined in:
lib/ramaze/asset/spec/bacon/color_output.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#handle_requirement(description) ⇒ Object

:nodoc:



13
14
15
16
17
18
19
20
21
# File 'lib/ramaze/asset/spec/bacon/color_output.rb', line 13

def handle_requirement(description)
  error = yield

  if !error.empty?
    puts "#{spaces} \e[31m- #{description} [FAILED]\e[0m"
  else
    puts "#{spaces} \e[32m- #{description}\e[0m"
  end
end

#handle_specification(name) ⇒ Object

:nodoc:



6
7
8
9
10
# File 'lib/ramaze/asset/spec/bacon/color_output.rb', line 6

def handle_specification(name)
  puts spaces + name
  yield
  puts if Counter[:context_depth] == 1
end

#handle_summaryObject

:nodoc:



24
25
26
27
28
# File 'lib/ramaze/asset/spec/bacon/color_output.rb', line 24

def handle_summary
  print ErrorLog  if Backtraces
  puts "%d specifications (%d requirements), %d failures, %d errors" %
    Counter.values_at(:specifications, :requirements, :failed, :errors)
end

#spacesObject

:nodoc:



31
32
33
34
35
36
37
# File 'lib/ramaze/asset/spec/bacon/color_output.rb', line 31

def spaces
  if Counter[:context_depth] === 0
    Counter[:context_depth] = 1
  end

  return ' ' * (Counter[:context_depth] - 1)
end