Sha256: 27bdf7c76e224e95b51a3168b776ff940fa2493be0b5e62e200126d843e0f5a2

Contents?: true

Size: 1.12 KB

Versions: 386

Compression:

Stored size: 1.12 KB

Contents

module Gherkin
  module Formatter
    class TagCountFormatter
      def initialize(formatter, tag_counts)
        @formatter = formatter
        @tag_counts = tag_counts
      end

      def uri(uri)
        @uri = uri
      end

      def feature(feature)
        @feature_tags = feature.tags
        @formatter.feature(feature)
      end

      def scenario(scenario)
        record_tags((@feature_tags.to_a + scenario.tags.to_a).uniq, scenario.line)
        @formatter.scenario(scenario)
      end

      def scenario_outline(scenario_outline)
        @scenario_outline_tags = scenario_outline.tags
        @formatter.scenario_outline(scenario_outline)
      end

      def examples(examples)
        record_tags((@feature_tags.to_a + @scenario_outline_tags.to_a + examples.tags.to_a).uniq, examples.line)
        @formatter.examples(examples)
      end

    private

      def record_tags(tags, line)
        tags.each do |tag|
          @tag_counts[tag.name] ||= []
          @tag_counts[tag.name] << "#{@uri}:#{line}"
        end
      end

      def method_missing(*args)
        @formatter.__send__(*args)
      end
    end
  end
end

Version data entries

386 entries across 379 versions & 11 rubygems

Version Path
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/gherkin-2.12.2/lib/gherkin/formatter/tag_count_formatter.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/gherkin-2.12.2/lib/gherkin/formatter/tag_count_formatter.rb
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/gherkin-2.12.2/lib/gherkin/formatter/tag_count_formatter.rb
gherkin-2.12.2 lib/gherkin/formatter/tag_count_formatter.rb
gherkin-2.12.2-x86-mswin32 lib/gherkin/formatter/tag_count_formatter.rb
gherkin-2.12.2-x86-mingw32 lib/gherkin/formatter/tag_count_formatter.rb
gherkin-2.12.2-java lib/gherkin/formatter/tag_count_formatter.rb
candlepin-api-0.4.0 bundle/ruby/1.8/gems/gherkin-2.11.1/lib/gherkin/formatter/tag_count_formatter.rb
candlepin-api-0.4.0 bundle/ruby/1.9.1/gems/gherkin-2.11.1/lib/gherkin/formatter/tag_count_formatter.rb
candlepin-api-0.4.0 bundle/ruby/gems/gherkin-2.11.1/lib/gherkin/formatter/tag_count_formatter.rb
gherkin-2.12.1 lib/gherkin/formatter/tag_count_formatter.rb
gherkin-2.12.1-x86-mswin32 lib/gherkin/formatter/tag_count_formatter.rb
gherkin-2.12.1-x86-mingw32 lib/gherkin/formatter/tag_count_formatter.rb
gherkin-2.12.1-java lib/gherkin/formatter/tag_count_formatter.rb
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/gherkin-2.11.6/lib/gherkin/formatter/tag_count_formatter.rb
gherkin-2.12.0 lib/gherkin/formatter/tag_count_formatter.rb
gherkin-2.12.0-x86-mingw32 lib/gherkin/formatter/tag_count_formatter.rb
gherkin-2.12.0-x86-mswin32 lib/gherkin/formatter/tag_count_formatter.rb
gherkin-2.12.0-java lib/gherkin/formatter/tag_count_formatter.rb
gherkin-2.11.8 lib/gherkin/formatter/tag_count_formatter.rb