Sha256: 451d9ad11705a1963fb2a5ffba2bbecf5e914a143c26021ad335bc086d9986bb

Contents?: true

Size: 1.67 KB

Versions: 1

Compression:

Stored size: 1.67 KB

Contents

module QED
module Reporter #:nodoc:

  require 'qed/reporter/base'

  # = DotProgress Reporter
  #
  class DotProgress < BaseClass

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

    #
    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

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

    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

    private

    #
    def clean_backtrace(btrace)
      btrace.chomp(":in `_binding'")
    end

  end#class DotProgress

end#module Reporter
end#module QED

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
qed-1.3 lib/qed/reporter/dotprogress.rb