Sha256: 8a908341b745ffaef5391125c6ad03ac07992ba3b97205257e23e903bf388a02

Contents?: true

Size: 582 Bytes

Versions: 2

Compression:

Stored size: 582 Bytes

Contents

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['keyword'] == 'Scenario Outline'

        next unless scenario.key? 'examples'
        next if scenario['examples'].length > 1
        next if scenario['examples'].first['rows'].length > 2

        references = [reference(file, feature, scenario)]
        add_error(references, 'Better write a scenario')
      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/avoid_outline_for_single_example.rb
gherkin_lint-0.3.0 lib/gherkin_lint/linter/avoid_outline_for_single_example.rb