Class: QED::Reporter::Dot

Inherits:
Abstract show all
Defined in:
lib/qed/reporter/dotprogress.rb

Overview

The dot reporter is the traditional test reporter where dot is printed for every successful step, an 'E' for errors and an 'F' for failures.

Constant Summary

Constant Summary

Constants inherited from Abstract

Abstract::DEFAULT_TRACE_COUNT, Abstract::INFO_SIGNAL, Abstract::INTERNALS

Instance Attribute Summary

Attributes inherited from Abstract

#io, #record, #session

Instance Method Summary collapse

Methods inherited from Abstract

After, Before, When, #after_demo, #after_eval, #after_import, #after_proc, #after_step, #before_demo, #before_eval, #before_import, #before_proc, #before_step, #call, #clean_backtrace, #code_snippet, #count_demo, #count_error, #count_fail, #count_pass, #count_step, #demo, #demos, #errors, #eval, #fails, #file_and_line, #file_line, #get_tally, #import, #initialize, #localize_file, #omits, #passes, #print_tally, #print_time, #proc, #relative_file, #rule, #sane_backtrace, #source, #step, #steps, #structured_code_snippet, #success?, #trace?, #trace_count

Constructor Details

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

Instance Method Details

#after_session(session) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/qed/reporter/dotprogress.rb', line 44

def after_session(session)
  print_time

  errors.each do |step, exception|
    backtrace = sane_backtrace(exception)

    io.puts "***** ERROR *****".ansi(:red)
    io.puts "#{exception}"
    backtrace.each do |bt|
      io.puts bt
      io.puts code_snippet(bt)
    end
    io.puts
  end

  fails.each do |step, assertion|
    backtrace = sane_backtrace(assertion)

    io.puts "***** FAIL *****".ansi(:red, :bold)
    io.puts "#{assertion}"
    backtrace.each do |bt|
      io.puts bt
      io.puts code_snippet(bt)
    end
    io.puts
  end

  print_tally
end

#before_session(session) ⇒ Object



13
14
15
16
# File 'lib/qed/reporter/dotprogress.rb', line 13

def before_session(session)
  @start_time = Time.now
  io.puts "Started"
end

#error(step, exception) ⇒ Object



37
38
39
40
41
# File 'lib/qed/reporter/dotprogress.rb', line 37

def error(step, exception)
  io.print "E".ansi(:red)
  io.flush
  super(step, exception)
end

#fail(step, assertion) ⇒ Object



31
32
33
34
35
# File 'lib/qed/reporter/dotprogress.rb', line 31

def fail(step, assertion)
  io.print "F".ansi(:red)
  io.flush
  super(step, assertion)
end

#pass(step) ⇒ Object

def before_step(step)

super(step)
io.print "."
io.flush

end



25
26
27
28
29
# File 'lib/qed/reporter/dotprogress.rb', line 25

def pass(step)
  io.print "."
  io.flush
  super(step)
end