Class: QED::Reporter::BulletPoint

Inherits:
Abstract
  • Object
show all
Defined in:
lib/qed/reporter/bullet.rb

Overview

Bullet Point Reporter

Similar to the Verbose reporter, but does not display test code for passing tests.

Instance Attribute Summary

Attributes inherited from Abstract

#io, #omit, #steps

Instance Method Summary collapse

Methods inherited from Abstract

After, Before, When, #after_code, #after_document, #after_session, #before_code, #before_document, #before_session, #code, #errors, #failures, #import, #initialize, #load, #passes, #trace?, #unload, #update, #when

Constructor Details

This class inherits a constructor from QED::Reporter::Abstract

Instance Method Details

#error(step, exception) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/qed/reporter/bullet.rb', line 39

def error(step, exception)
  raise exception if $DEBUG
  msg = ''
  msg << "  ##### ERROR #####\n"
  msg << "  # " + exception.to_s + "\n"
  msg << "  # " + clean_backtrace(exception.backtrace[0])
  msg = msg.ansi(:magenta)
  io.puts msg
  #io.puts
  io.puts "#{step.text}".ansi(:red)
end

#fail(step, assertion) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/qed/reporter/bullet.rb', line 29

def fail(step, assertion)
  msg = ''
  msg << "  ##### FAIL #####\n"
  msg << "  # " + assertion.to_s
  msg = msg.ansi(:magenta)
  io.puts msg
  #io.puts
  io.puts "#{step.text}".ansi(:red)
end

#pass(step) ⇒ Object



25
26
27
# File 'lib/qed/reporter/bullet.rb', line 25

def pass(step)
  #io.puts "#{step}".ansi(:green)
end

#text(step) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/qed/reporter/bullet.rb', line 13

def text(step)
  case step.text
  when /^\=/
    io.puts "#{step.text}".ansi(:bold)
  else
    txt = step.text.to_s.strip.tabto(2)
    txt[0,1] = "*"
    io.puts txt
    io.puts
  end
end