funkwerk/gherkin_lint

View on GitHub
lib/gherkin_lint/linter/missing_scenario_name.rb

Summary

Maintainability
A
35 mins
Test Coverage
require 'gherkin_lint/linter'

module GherkinLint
  # service class to lint for missing scenario names
  class MissingScenarioName < Linter
    def lint
      scenarios do |file, feature, scenario|
        name = scenario.key?(:name) ? scenario[:name].strip : ''
        references = [reference(file, feature, scenario)]
        next unless name.empty?
        add_error(references, 'No Scenario Name')
      end
    end
  end
end