Sha256: 80b163a7bedab930865c1600eb6e65c6e5cd7165381726859998f413b75fd5d2

Contents?: true

Size: 842 Bytes

Versions: 5

Compression:

Stored size: 842 Bytes

Contents

require 'cucumber/formatters/ansicolor'

module Cucumber
  module Formatters
    class ProgressFormatter
      include ANSIColor

      def initialize(io)
        @io = (io == STDOUT) ? Kernel : io
        @errors = []
      end

      def step_executed(step)
        case(step.error)
        when Pending
          @io.print pending('P')
        when NilClass
          @io.print passed('.')
        else
          @errors << step.error
          @io.print failed('F')
        end
      end
    
      def step_skipped(step)
        @io.print skipped('_')
      end

      def dump
        @io.puts failed
        @errors.each_with_index do |error,n|
          @io.puts
          @io.puts "#{n+1})"
          @io.puts error.message
          @io.puts error.backtrace.join("\n")
        end
        @io.print reset
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
aslakhellesoy-cucumber-0.0.1 lib/cucumber/formatters/progress_formatter.rb
aslakhellesoy-cucumber-0.1.1 lib/cucumber/formatters/progress_formatter.rb
aslakhellesoy-cucumber-0.1.2 lib/cucumber/formatters/progress_formatter.rb
aslakhellesoy-cucumber-0.1.3 lib/cucumber/formatters/progress_formatter.rb
aslakhellesoy-cucumber-0.1.4 lib/cucumber/formatters/progress_formatter.rb