Sha256: 66f6cb11f3528052103b57c2381b0faee1500b0a209702595617a528398b4d7e

Contents?: true

Size: 653 Bytes

Versions: 7

Compression:

Stored size: 653 Bytes

Contents

module Tag
  # Custom formatter that reports occurrences of each tag
  class Count < Cucumber::Ast::Visitor
    def initialize(step_mother, io, options)
      super(step_mother)
      @io = io
      @counts = Hash.new{|h,k| h[k] = 0}
    end

    def visit_features(features)
      super
      print_summary
    end

    def visit_tag_name(tag_name)
      @counts[tag_name] += 1
    end
    
    def print_summary
      matrix = @counts.to_a.sort{|paira, pairb| paira[0] <=> pairb[0]}.transpose
      table = Cucumber::Ast::Table.new(matrix)
      Cucumber::Formatter::Pretty.new(@step_mother, @io, {}).visit_multiline_arg(table, :tag)
    end
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
aslakhellesoy-cucumber-0.1.99.20 examples/self_test/features/support/tag_count_formatter.rb
aslakhellesoy-cucumber-0.1.99.21 examples/self_test/features/support/tag_count_formatter.rb
aslakhellesoy-cucumber-0.1.99.22 examples/self_test/features/support/tag_count_formatter.rb
aslakhellesoy-cucumber-0.1.99.23 examples/self_test/features/support/tag_count_formatter.rb
kosmas58-cucumber-0.1.99.21 examples/self_test/features/support/tag_count_formatter.rb
kosmas58-cucumber-0.1.99.23 examples/self_test/features/support/tag_count_formatter.rb
notch8-cucumber-0.1.99.23 examples/self_test/features/support/tag_count_formatter.rb