Class: QED::Reporter::BulletPoint

Inherits:
Abstract 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, #record, #session

Instance Method Summary collapse

Methods inherited from Abstract

After, Before, When, #after_code, #after_data, #after_demo, #after_desc, #after_head, #after_step, #before_code, #before_data, #before_demo, #before_desc, #before_head, #before_session, #before_step, #code, #count_code, #count_demo, #count_desc, #count_error, #count_fail, #count_pass, #data, #demo, #demos, #errors, #fails, #import, #initialize, #load, #omits, #passes, #steps, #trace?, #unload, #update, #when

Constructor Details

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

Instance Method Details

#after_session(session) ⇒ Object

def report_macro(step)

txt = step.to_s.tabto(2)
txt[0,1] = "*"
io.puts txt
#io.puts
#io.puts "#{step}".ansi(:magenta)

end



83
84
85
86
# File 'lib/qed/reporter/bullet.rb', line 83

def after_session(session)
  print_time
  print_tally
end

#desc(step) ⇒ Object



16
17
18
19
20
21
# File 'lib/qed/reporter/bullet.rb', line 16

def desc(step)
  txt = step.to_s.strip.tabto(2)
  txt[0,1] = "*"
  io.puts txt
  io.puts
end

#error(step, exception) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/qed/reporter/bullet.rb', line 43

def error(step, exception)
  raise exception if $DEBUG

  backtrace = sane_backtrace(exception)

  msg = []
  msg << "  " + "ERROR".ansi(:red)
  msg << ""
  msg << "  " + exception.to_s
  msg << ""
  backtrace.each do |bt|
    msg << "  " + relative_file(bt)
  end
  io.puts msg.join("\n")
  io.puts
  io.print step.text.tabto(4)
end

#fail(step, assertion) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/qed/reporter/bullet.rb', line 27

def fail(step, assertion)
  backtrace = sane_backtrace(assertion)

  msg = []
  msg << "  " + "FAIL".ansi(:red)
  msg << ""
  msg << assertion.to_s.gsub(/^/, '  ')
  msg << ""
  backtrace.each do |bt|
    msg << "  " + relative_file(bt)
  end
  io.puts msg.join("\n")
  io.puts
  io.print step.text.tabto(4)
end

#head(step) ⇒ Object



12
13
14
# File 'lib/qed/reporter/bullet.rb', line 12

def head(step)
  io.print "#{step}".ansi(:bold)
end

#pass(step) ⇒ Object



23
24
25
# File 'lib/qed/reporter/bullet.rb', line 23

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