Sha256: 2a131944ae303f33528c7f27a51da4e6a82ebeda3c67491fbd86340335a1b899

Contents?: true

Size: 588 Bytes

Versions: 2

Compression:

Stored size: 588 Bytes

Contents

require 'gherkin_lint/linter'

module GherkinLint
  # service class to lint for background that does more than setup
  class BackgroundDoesMoreThanSetup < Linter
    def lint
      backgrounds do |file, feature, background|
        next unless background.key? 'steps'
        invalid_steps = background['steps'].select { |step| step['keyword'] == 'When ' || step['keyword'] == 'Then ' }
        next if invalid_steps.empty?
        references = [reference(file, feature, background, invalid_steps[0])]
        add_error(references, 'Just Given Steps allowed')
      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_does_more_than_setup.rb
gherkin_lint-0.3.0 lib/gherkin_lint/linter/background_does_more_than_setup.rb