Sha256: 9be4cf5ac89f855ee0ca161fbcaf360f7bd6066072c078585e907299f1e27c30

Contents?: true

Size: 1.43 KB

Versions: 13

Compression:

Stored size: 1.43 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 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

13 entries across 13 versions & 4 rubygems

Version Path
aslakhellesoy-cucumber-0.1.10 lib/cucumber/formatters/progress_formatter.rb
aslakhellesoy-cucumber-0.1.11 lib/cucumber/formatters/progress_formatter.rb
aslakhellesoy-cucumber-0.1.12 lib/cucumber/formatters/progress_formatter.rb
aslakhellesoy-cucumber-0.1.9 lib/cucumber/formatters/progress_formatter.rb
bts-cucumber-0.1.13.1 lib/cucumber/formatters/progress_formatter.rb
bts-cucumber-0.1.13.2 lib/cucumber/formatters/progress_formatter.rb
bts-cucumber-0.1.13.3 lib/cucumber/formatters/progress_formatter.rb
jeffrafter-cucumber-0.1.10 lib/cucumber/formatters/progress_formatter.rb
jeffrafter-cucumber-0.1.12 lib/cucumber/formatters/progress_formatter.rb
cucumber-0.1.11 lib/cucumber/formatters/progress_formatter.rb
cucumber-0.1.10 lib/cucumber/formatters/progress_formatter.rb
cucumber-0.1.12 lib/cucumber/formatters/progress_formatter.rb
cucumber-0.1.9 lib/cucumber/formatters/progress_formatter.rb