Sha256: 9616f2e9a1df3f7d154ed379be6a179ff7ad49ebe6367770bbff16a420c29e59

Contents?: true

Size: 548 Bytes

Versions: 4

Compression:

Stored size: 548 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[:children].reject { |element| element[:type] == :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

4 entries across 4 versions & 1 rubygems

Version Path
gherkin_lint-1.2.2 lib/gherkin_lint/linter/background_requires_multiple_scenarios.rb
gherkin_lint-1.2.1 lib/gherkin_lint/linter/background_requires_multiple_scenarios.rb
gherkin_lint-1.1.0 lib/gherkin_lint/linter/background_requires_multiple_scenarios.rb
gherkin_lint-1.0.0 lib/gherkin_lint/linter/background_requires_multiple_scenarios.rb