Sha256: 22bef22fe54aa6809f386a0be6c1be1efd95d144ad5d9989d69c4fc0f4b50b52

Contents?: true

Size: 647 Bytes

Versions: 51

Compression:

Stored size: 647 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)
    end
  end
end

Version data entries

51 entries across 51 versions & 5 rubygems

Version Path
aslakhellesoy-cucumber-0.1.100.1 examples/self_test/features/support/tag_count_formatter.rb
aslakhellesoy-cucumber-0.1.100.2 examples/self_test/features/support/tag_count_formatter.rb
aslakhellesoy-cucumber-0.1.100.3 examples/self_test/features/support/tag_count_formatter.rb
aslakhellesoy-cucumber-0.1.100.4 examples/self_test/features/support/tag_count_formatter.rb
aslakhellesoy-cucumber-0.1.100.5 examples/self_test/features/support/tag_count_formatter.rb
aslakhellesoy-cucumber-0.2.0.1 examples/self_test/features/support/tag_count_formatter.rb
aslakhellesoy-cucumber-0.2.0.2 examples/self_test/features/support/tag_count_formatter.rb
aslakhellesoy-cucumber-0.2.0.3 examples/self_test/features/support/tag_count_formatter.rb
aslakhellesoy-cucumber-0.2.0.4 examples/self_test/features/support/tag_count_formatter.rb
aslakhellesoy-cucumber-0.2.0 examples/self_test/features/support/tag_count_formatter.rb
aslakhellesoy-cucumber-0.2.1 examples/self_test/features/support/tag_count_formatter.rb
aslakhellesoy-cucumber-0.2.2.1 examples/self_test/features/support/tag_count_formatter.rb
aslakhellesoy-cucumber-0.2.2.2 examples/self_test/features/support/tag_count_formatter.rb
aslakhellesoy-cucumber-0.2.2 examples/self_test/features/support/tag_count_formatter.rb
aslakhellesoy-cucumber-0.2.3.1 examples/self_test/features/support/tag_count_formatter.rb
aslakhellesoy-cucumber-0.2.3.2 examples/self_test/features/support/tag_count_formatter.rb
aslakhellesoy-cucumber-0.2.3.3 examples/self_test/features/support/tag_count_formatter.rb
aslakhellesoy-cucumber-0.2.3.4 examples/self_test/features/support/tag_count_formatter.rb
aslakhellesoy-cucumber-0.2.3 examples/self_test/features/support/tag_count_formatter.rb
aslakhellesoy-cucumber-0.3.0.1 examples/self_test/features/support/tag_count_formatter.rb