Sha256: 7faece32f36f23a76a559b1928600439032044e6112b222034b7c09f23698752

Contents?: true

Size: 1.59 KB

Versions: 3

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 head(step)
      io.print "#{step}".ansi(:bold)
    end

    def desc(step)
      txt = step.to_s.strip.tabto(2)
      txt[0,1] = "*"
      io.puts txt
      io.puts
    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

    def after_session(session)
      print_time
      print_tally
    end

  end #class Summary

end#module Reporter
end#module QED

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
qed-2.5.1 lib/qed/reporter/bullet.rb
qed-2.5.0 lib/qed/reporter/bullet.rb
qed-2.4.0 lib/qed/reporter/bullet.rb