lib/gherkin_lint/linter/avoid_outline_for_single_example.rb
require 'gherkin_lint/linter'
module GherkinLint
# service class to lint for avoiding outline for single example
class AvoidOutlineForSingleExample < Linter
def lint
scenarios do |file, feature, scenario|
next unless scenario[:type] == :ScenarioOutline
next unless scenario.key? :examples
next if scenario[:examples].length > 1
next if scenario[:examples].first[:tableBody].length > 1
references = [reference(file, feature, scenario)]
add_error(references, 'Better write a scenario')
end
end
end
end