Sha256: fdc10d1f8f520c73e0820c6efda61df0d091b01cb8b8cab66bb984e162b24061

Contents?: true

Size: 663 Bytes

Versions: 6

Compression:

Stored size: 663 Bytes

Contents

require 'gherkin_lint/linter'

module GherkinLint
  # service class to lint for unique scenario names
  class UniqueScenarioNames < Linter
    def lint
      references_by_name = Hash.new []
      scenarios do |file, feature, scenario|
        next unless scenario.key? 'name'
        scenario_name = "#{feature['name']}.#{scenario['name']}"
        references_by_name[scenario_name] = references_by_name[scenario_name] + [reference(file, feature, scenario)]
      end
      references_by_name.each do |name, references|
        next if references.length <= 1
        add_issue(references, "'#{name}' used #{references.length} times")
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gherkin_lint-0.1.2 lib/gherkin_lint/linter/unique_scenario_names.rb
gherkin_lint-0.1.1 lib/gherkin_lint/linter/unique_scenario_names.rb
gherkin_lint-0.1.0 lib/gherkin_lint/linter/unique_scenario_names.rb
gherkin_lint-0.0.14 lib/gherkin_lint/linter/unique_scenario_names.rb
gherkin_lint-0.0.13 lib/gherkin_lint/linter/unique_scenario_names.rb
gherkin_lint-0.0.12 lib/gherkin_lint/linter/unique_scenario_names.rb