Sha256: 425e8d69b153fbf8527d72dbc7eb3d6495d0c6dc41de23763245156926d66c8b

Contents?: true

Size: 1.32 KB

Versions: 3

Compression:

Stored size: 1.32 KB

Contents

module QED
module Reporter #:nodoc:

  require 'qed/reporter/base'

  # = Html Reporter
  #
  class Html < BaseClass

    #
    def pass(step)
      step['class'] = 'pass'           # TODO add class not replace
      step['style'] = 'color: green;'  # TODO add style not replace
    end

    #
    def fail(step, assertion)
      step['class'] = 'fail'           # TODO add class not replace
      step['style'] = 'color: red;'    # TODO add style not replace

      msg = "\n"
      msg << "  ##### FAIL #####\n"
      msg << "  # " + assertion.to_s
      msg << "\n"

      step.add_child(Nokogiri::HTML.fragment(msg))
    end

    #
    def error(step, exception)
      raise exception if $DEBUG

      step['class'] = 'error'          # TODO add class not replace
      step['style'] = 'color: red;'    # TODO add style not replace

      msg = "\n"
      msg << "  ##### ERROR #####\n"
      msg << "  # " + exception.to_s + "\n"
      msg << "  # " + exception.backtrace[0]
      msg << "\n"

      step.add_child(Nokogiri::HTML.fragment(msg))
    end

    #
    def after_document(demo)
      io.puts demo.document.to_s
    end

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

  end

end#module Reporter
end#module QED

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
qed-2.1.1 lib/qed/reporter/html.rb
qed-2.0.0 lib/qed/reporter/html.rb
qed-2.1.0 lib/qed/reporter/html.rb