Sha256: bdbbc1e4a6700f0975ff59d3a661e1a4b203f14b42b888745e856e18370cbede

Contents?: true

Size: 1.59 KB

Versions: 2

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.text
      when /^\=/
        io.puts "#{step.text}".ansi(:bold)
      else
        txt = step.text.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.puts
      io.puts "#{step.text}".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.puts
      io.puts "#{step.text}".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

2 entries across 2 versions & 1 rubygems

Version Path
qed-2.2.1 lib/qed/reporter/bullet.rb
qed-2.2.0 lib/qed/reporter/bullet.rb