Sha256: 7eda1dfcf14c684eb48f89ee593d96ac9e5154b9e5d8df19ab2230805eab3d1a

Contents?: true

Size: 1.48 KB

Versions: 19

Compression:

Stored size: 1.48 KB

Contents

require 'cucumber/formatters/ansicolor'

module Cucumber
  module Formatters
    class ProgressFormatter
      include ANSIColor

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

      def scenario_executing(scenario)
        if scenario.pending?
          @pending_scenarios << scenario
          @io.print pending("P")
        end
      end

      def step_passed(step, regexp, args)
        @io.print passed('.')
      end

      def step_failed(step, regexp, args)
        @errors << step.error
        @io.print failed('F')
      end

      def step_pending(step, regexp, args)
        @pending_scenarios << step.scenario
        @io.print pending('P')
      end

      def step_skipped(step, regexp, args)
        @io.print skipped('_')
      end

      def step_traced(step, regexp, args)
      end

      def dump
        @io.puts pending
        @io.puts "\nPending Scenarios:\n\n" if @pending_scenarios.any?
        @pending_scenarios.uniq.each_with_index do |scenario, n|
          @io.puts "#{n+1}) #{scenario.feature.header.split("\n").first.gsub(/^(Feature|Story):/, '')} (#{scenario.name})"
        end

        @io.puts failed
        @io.puts "\nFailed:" if @errors.any?
        @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

19 entries across 19 versions & 4 rubygems

Version Path
aslakhellesoy-cucumber-0.1.13.2 lib/cucumber/formatters/progress_formatter.rb
aslakhellesoy-cucumber-0.1.13.3 lib/cucumber/formatters/progress_formatter.rb
aslakhellesoy-cucumber-0.1.13 lib/cucumber/formatters/progress_formatter.rb
aslakhellesoy-cucumber-0.1.14.1 lib/cucumber/formatters/progress_formatter.rb
aslakhellesoy-cucumber-0.1.14.2 lib/cucumber/formatters/progress_formatter.rb
aslakhellesoy-cucumber-0.1.15 lib/cucumber/formatters/progress_formatter.rb
aslakhellesoy-cucumber-0.1.16.1 lib/cucumber/formatters/progress_formatter.rb
aslakhellesoy-cucumber-0.1.16.2 lib/cucumber/formatters/progress_formatter.rb
aslakhellesoy-cucumber-0.1.16.3 lib/cucumber/formatters/progress_formatter.rb
aslakhellesoy-cucumber-0.1.16.4 lib/cucumber/formatters/progress_formatter.rb
aslakhellesoy-cucumber-0.1.16 lib/cucumber/formatters/progress_formatter.rb
kosmas58-cucumber-0.1.16.5 lib/cucumber/formatters/progress_formatter.rb
kosmas58-cucumber-0.1.16.6 lib/cucumber/formatters/progress_formatter.rb
cucumber-0.1.14 lib/cucumber/formatters/progress_formatter.rb
cucumber-0.1.13 lib/cucumber/formatters/progress_formatter.rb
cucumber-0.1.16 lib/cucumber/formatters/progress_formatter.rb
cucumber-0.1.15 lib/cucumber/formatters/progress_formatter.rb
mack-0.8.3 lib/gems/cucumber-0.1.15/lib/cucumber/formatters/progress_formatter.rb
mack-0.8.3.1 lib/gems/cucumber-0.1.15/lib/cucumber/formatters/progress_formatter.rb