Sha256: aada526885e0e5d932d969e1518abd5573c1764bbfe4f97e151148ca71901f66

Contents?: true

Size: 1.59 KB

Versions: 1

Compression:

Stored size: 1.59 KB

Contents

module QED
module Reporter #:nodoc:

  require 'qed/reporter/abstract'

  # = Bullet Point Reporter
  #
  # Similar to the Verbose reporter, but does
  # not display test code for passing tests.
  class BulletPoint < Abstract

    #
    def text(step)
      case step.commentary
      when /^\=/
        io.print "#{step.commentary}".ansi(:bold)
      else
        txt = step.commentary.to_s.strip.tabto(2)
        txt[0,1] = "*"
        io.puts txt
        io.puts
      end
    end

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

    def fail(step, assertion)
      msg = ''
      msg << "  ##### FAIL #####\n"
      msg << "  # " + assertion.to_s
      msg = msg.ansi(:magenta)
      io.puts msg
      io.print "#{step.example}".ansi(:red)
    end

    def error(step, exception)
      raise exception if $DEBUG
      msg = ''
      msg << "  ##### ERROR #####\n"
      msg << "  # " + exception.to_s + "\n"
      msg << "  # " + clean_backtrace(exception.backtrace[0])
      msg = msg.ansi(:magenta)
      io.puts msg
      io.print "#{step.example}".ansi(:red)
    end

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

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

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

  end #class Summary

end#module Reporter
end#module QED

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
qed-2.3.0 lib/qed/reporter/bullet.rb