Module: Bacon::SpecDoxOutput

Defined in:
lib/motion-redgreen/spec_setup.rb,
lib/motion-redgreen/spec_setup.rb,
lib/motion-redgreen/spec_setup.rb

Instance Method Summary collapse

Instance Method Details

#handle_requirement_begin(description) ⇒ Object



30
31
32
# File 'lib/motion-redgreen/spec_setup.rb', line 30

def handle_requirement_begin(description)
  puts "#{spaces}  - #{description}".magenta
end

#handle_requirement_end(error) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/motion-redgreen/spec_setup.rb', line 34

def handle_requirement_end(error)
  color = color_for(error)
  if error.empty?
    mark = "✓".green
    msg = "This test has passed! Good job!".green
  else
    mark = "✗".send(color)
    msg = "This test has not passed: #{error}!".send(color)
    error_output = "[#{error}] \n BACKTRACE: #{ErrorLog}".send(color)
  end
  puts " [#{mark}] #{msg} \n #{error_output ||= ""}"
  ErrorLog.clear
end

#handle_specification_begin(name) ⇒ Object



22
23
24
# File 'lib/motion-redgreen/spec_setup.rb', line 22

def handle_specification_begin(name)
  puts "#{spaces + name}".bold
end

#handle_specification_endObject



26
27
28
# File 'lib/motion-redgreen/spec_setup.rb', line 26

def handle_specification_end
  puts if Counter[:context_depth] == 1
end

#handle_summaryObject



48
49
50
51
52
53
54
# File 'lib/motion-redgreen/spec_setup.rb', line 48

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