Sha256: 74d4fc8fe52d142cf9a928baebbed7e74f9d8d40bb1d3db44be0ea02f8667ce3

Contents?: true

Size: 1.83 KB

Versions: 1

Compression:

Stored size: 1.83 KB

Contents

require 'quarry/spec/reporter'

module Quarry

  module Spec

    class Reporter

      # = Verbatim Reporter
      #
      class Verbatim < Reporter

        #def report_step(step)
        #  super
        #  if step.code
        #    #str = "(%s) %s" % [count.join('.'), str.tab(6).strip]
        #    #puts "* #{step.text.tab(2).strip}"
        #    #puts
        #    #puts step.text
        #    #puts
        #  else
        #    #puts "#{step.text}\n"  # TODO: This never happens.
        #  end
        #end

        def report_header(step)
          puts ANSICode.bold(step.text)
          puts
        end

        def report_comment(step)
          puts step.text
          puts
        end

        def report_macro(step)
          #puts
          #puts step.text
          puts ANSICode.magenta("#{step.code}")
          puts
        end

        def report_pass(step)
          puts ANSICode.green("#{step.code}")
          puts
        end

        def report_fail(step, assertion)
          msg = ''
          msg << "##### FAIL #####\n"
          msg << assertion.to_s + "\n"
          msg << assertion.backtrace[2]
          msg = ANSICode.magenta(msg)
          puts msg
          puts
          puts ANSICode.red("#{step.code}")
          puts
        end

        def report_error(step, exception)
          raise exception if $DEBUG
          msg = ''
          msg << "##### ERROR #####\n"
          msg << exception.to_s + "\n"
          msg << exception.backtrace[0]
          msg = ANSICode.magenta(msg)
          puts msg
          puts
          puts ANSICode.red("#{step.code}")
          puts
        end

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

      end

    end

  end

end #module Quarry

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
quarry-0.4.0 lib/quarry/spec/reporter/verbatim.rb