Sha256: 17292c2ef1fee494e029e81219165ee88c3a31a25b4f582603987ac624835f39

Contents?: true

Size: 588 Bytes

Versions: 6

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_issue(references, 'Just Given Steps allowed')
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gherkin_lint-0.1.2 lib/gherkin_lint/linter/background_does_more_than_setup.rb
gherkin_lint-0.1.1 lib/gherkin_lint/linter/background_does_more_than_setup.rb
gherkin_lint-0.1.0 lib/gherkin_lint/linter/background_does_more_than_setup.rb
gherkin_lint-0.0.14 lib/gherkin_lint/linter/background_does_more_than_setup.rb
gherkin_lint-0.0.13 lib/gherkin_lint/linter/background_does_more_than_setup.rb
gherkin_lint-0.0.12 lib/gherkin_lint/linter/background_does_more_than_setup.rb