Class: QED::Reporter::Ditto

Inherits:
BaseClass show all
Defined in:
lib/qed/reporter/ditto.rb

Overview

DotProgress Reporter

Constant Summary

Constants inherited from BaseClass

BaseClass::ANSICode

Instance Attribute Summary

Attributes inherited from BaseClass

#error, #fail, #io, #pass, #steps

Instance Method Summary collapse

Methods inherited from BaseClass

#initialize, #report_comment, #report_end, #report_error, #report_fail, #report_header, #report_macro, #report_omit, #report_pass, #report_start, #report_step_end, #verbose?

Constructor Details

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

Instance Method Details

#report_introObject



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

def report_intro
  #@start_time = Time.now
  #io.puts "Started"
end

#report_step(step) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/qed/reporter/ditto.rb', line 17

def report_step(step)
  super
  #if step.code
    io.print "."
    #str = "(%s) %s" % [count.join('.'), str.tab(6).strip]
    #puts "* #{step.text.tab(2).strip}"
    #puts "\n#{step.code}\n" if $VERBOSE
  #else
    #puts "\n#{step.text}"
  #end
end

#report_summaryObject

def report(str)

count[-1] += 1 unless count.empty?
str = str.chomp('.') + '.'
str = count.join('.') + ' ' + str
puts str.strip

end



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/qed/reporter/ditto.rb', line 36

def report_summary
  io.puts "\nFinished in #{Time.now - @start_time} seconds.\n\n"

  @error.each do |step, exception|
    backtrace = clean_backtrace(exception.backtrace[0])
    io.puts ANSICode.red("***** ERROR *****")
    io.puts "#{exception}"
    io.puts ":#{backtrace}:"
    #io.puts ":#{exception.backtrace[1]}:"
    #io.puts exception.backtrace[1..-1] if $VERBOSE
    io.puts
  end

  @fail.each do |step, assertion|
    backtrace = clean_backtrace(assertion.backtrace[0])
    io.puts ANSICode.red("***** FAIL *****")
    io.puts ANSICode.bold("#{assertion}")
    io.puts ":#{backtrace}:"
    #io.puts assertion if $VERBOSE
    io.puts
  end

  io.puts "%s demos, %s steps, %s failures, %s errors" % [@demos, @steps, @fail.size, @error.size] #, @pass.size ]
end