Sha256: bdb3f4453950d7b7259ec088d5c044033693f5f8d4a7d0654b256c80ed154863

Contents?: true

Size: 1.23 KB

Versions: 14

Compression:

Stored size: 1.23 KB

Contents

require 'cucumber/formatter/console'

module Cucumber
  module Formatter
    class Progress < Ast::Visitor
      include Console

      def initialize(step_mother, io, options)
        super(step_mother)
        @io = io
        @options = options
      end

      def visit_features(features)
        super
        @io.puts
        @io.puts
        print_summary
      end

      def visit_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
        progress(status)
        @status = status
      end

      def visit_table_cell_value(value, width, status)
        status ||= @status
        progress(status) unless table_header_cell?(status)
      end

      private

      def print_summary
        print_steps(:pending)
        print_steps(:failed)
        print_counts
        print_snippets(@options)
      end

      CHARS = {
        :passed    => '.',
        :failed    => 'F',
        :undefined => 'U',
        :pending   => 'P',
        :skipped   => '-'
      }

      def progress(status)
        char = CHARS[status]
        @io.print(format_string(char, status))
        @io.flush
      end
      
      def table_header_cell?(status)
        status == :skipped_param
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
aslakhellesoy-cucumber-0.3.2 lib/cucumber/formatter/progress.rb
aslakhellesoy-cucumber-0.3.3.1 lib/cucumber/formatter/progress.rb
aslakhellesoy-cucumber-0.3.3.2 lib/cucumber/formatter/progress.rb
aslakhellesoy-cucumber-0.3.3.3 lib/cucumber/formatter/progress.rb
aslakhellesoy-cucumber-0.3.3.4 lib/cucumber/formatter/progress.rb
aslakhellesoy-cucumber-0.3.3.5 lib/cucumber/formatter/progress.rb
aslakhellesoy-cucumber-0.3.3.6 lib/cucumber/formatter/progress.rb
aslakhellesoy-cucumber-0.3.3 lib/cucumber/formatter/progress.rb
aslakhellesoy-cucumber-0.3.4 lib/cucumber/formatter/progress.rb
aslakhellesoy-cucumber-0.3.5 lib/cucumber/formatter/progress.rb
cucumber-0.3.5 lib/cucumber/formatter/progress.rb
cucumber-0.3.4 lib/cucumber/formatter/progress.rb
cucumber-0.3.3 lib/cucumber/formatter/progress.rb
cucumber-0.3.2 lib/cucumber/formatter/progress.rb