Sha256: 53bcbf1f5de3570d13e867c3a6c7e6e3ea4a430b0cb9a0310777d1efc3b2f120

Contents?: true

Size: 1.45 KB

Versions: 13

Compression:

Stored size: 1.45 KB

Contents

module QED
module Reporter #:nodoc:

  require 'qed/reporter/abstract'

  # 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.
  #
  class Dot < Abstract

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

    #
    #def before_step(step)
    #  super(step)
    #  io.print "."
    #  io.flush
    #end

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

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

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

    #
    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

  end#class DotProgress

end#module Reporter
end#module QED

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
qed-2.9.2 lib/qed/reporter/dotprogress.rb
qed-2.9.1 lib/qed/reporter/dotprogress.rb
qed-2.9.0 lib/qed/reporter/dotprogress.rb
qed-2.8.8 lib/qed/reporter/dotprogress.rb
qed-2.8.7 lib/qed/reporter/dotprogress.rb
qed-2.8.6 lib/qed/reporter/dotprogress.rb
qed-2.8.5 lib/qed/reporter/dotprogress.rb
qed-2.8.4 lib/qed/reporter/dotprogress.rb
qed-2.8.3 lib/qed/reporter/dotprogress.rb
qed-2.8.2 lib/qed/reporter/dotprogress.rb
qed-2.8.1 lib/qed/reporter/dotprogress.rb
qed-2.8.0 lib/qed/reporter/dotprogress.rb
qed-2.7.0 lib/qed/reporter/dotprogress.rb