Sha256: 7a3e58f4b3e3b80620a7bd4fe466feab0c5dfedf5e1cc559ab8b46187a451a00

Contents?: true

Size: 1.29 KB

Versions: 29

Compression:

Stored size: 1.29 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(features)
      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(features)
        print_steps(:pending)
        print_steps(:failed)
        print_stats(features)
        print_snippets(@options)
        print_passing_wip(@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

29 entries across 29 versions & 6 rubygems

Version Path
aslakhellesoy-cucumber-0.3.10 lib/cucumber/formatter/progress.rb
aslakhellesoy-cucumber-0.3.11.1 lib/cucumber/formatter/progress.rb
aslakhellesoy-cucumber-0.3.11.3 lib/cucumber/formatter/progress.rb
aslakhellesoy-cucumber-0.3.11.5 lib/cucumber/formatter/progress.rb
aslakhellesoy-cucumber-0.3.11.6 lib/cucumber/formatter/progress.rb
aslakhellesoy-cucumber-0.3.11 lib/cucumber/formatter/progress.rb
aslakhellesoy-cucumber-0.3.7.2 lib/cucumber/formatter/progress.rb
aslakhellesoy-cucumber-0.3.7.3 lib/cucumber/formatter/progress.rb
aslakhellesoy-cucumber-0.3.7.4 lib/cucumber/formatter/progress.rb
aslakhellesoy-cucumber-0.3.7.5 lib/cucumber/formatter/progress.rb
aslakhellesoy-cucumber-0.3.8 lib/cucumber/formatter/progress.rb
aslakhellesoy-cucumber-0.3.9.1 lib/cucumber/formatter/progress.rb
aslakhellesoy-cucumber-0.3.9.2 lib/cucumber/formatter/progress.rb
aslakhellesoy-cucumber-0.3.9.3 lib/cucumber/formatter/progress.rb
aslakhellesoy-cucumber-0.3.9.4 lib/cucumber/formatter/progress.rb
aslakhellesoy-cucumber-0.3.9.5 lib/cucumber/formatter/progress.rb
aslakhellesoy-cucumber-0.3.9 lib/cucumber/formatter/progress.rb
jwilger-cucumber-0.3.11.200906161550 lib/cucumber/formatter/progress.rb
jwilger-cucumber-0.3.11.200907091518 lib/cucumber/formatter/progress.rb
kosmas58-cucumber-0.3.11.3 lib/cucumber/formatter/progress.rb