Sha256: 700367fd09924f48ccf7340c29588d1fb0537a359a71af0ef599d3c4ebb365d2

Contents?: true

Size: 592 Bytes

Versions: 2

Compression:

Stored size: 592 Bytes

Contents

require 'gherkin_lint/linter'

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gherkin_lint-0.3.1 lib/gherkin_lint/linter/missing_example_name.rb
gherkin_lint-0.3.0 lib/gherkin_lint/linter/missing_example_name.rb