Sha256: 8475f0de486eb7b6d6145c7832c4c06d2a86de7311e45d3ede490ad2a2a131f8

Contents?: true

Size: 554 Bytes

Versions: 2

Compression:

Stored size: 554 Bytes

Contents

require 'gherkin_lint/linter'

module GherkinLint
  # service class for check that there are multiple scenarios once a background is used
  class BackgroundRequiresMultipleScenarios < Linter
    def lint
      backgrounds do |file, feature, background|
        scenarios = feature['elements'].select { |element| element['keyword'] != 'Background' }
        next if scenarios.length >= 2

        references = [reference(file, feature, background)]
        add_error(references, "There are just #{scenarios.length} scenarios")
      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/background_requires_multiple_scenarios.rb
gherkin_lint-0.3.0 lib/gherkin_lint/linter/background_requires_multiple_scenarios.rb