Sha256: 65547bf237a29ffe99ad95aae7a3a83c3b6d4d82b41295e1ec8b9fb080bd1e78

Contents?: true

Size: 584 Bytes

Versions: 14

Compression:

Stored size: 584 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

14 entries across 14 versions & 1 rubygems

Version Path
gherkin_lint-1.2.2 lib/gherkin_lint/linter/background_does_more_than_setup.rb
gherkin_lint-1.2.1 lib/gherkin_lint/linter/background_does_more_than_setup.rb
gherkin_lint-1.1.0 lib/gherkin_lint/linter/background_does_more_than_setup.rb
gherkin_lint-1.0.0 lib/gherkin_lint/linter/background_does_more_than_setup.rb
gherkin_lint-0.6.3 lib/gherkin_lint/linter/background_does_more_than_setup.rb
gherkin_lint-0.6.2 lib/gherkin_lint/linter/background_does_more_than_setup.rb
gherkin_lint-0.6.1 lib/gherkin_lint/linter/background_does_more_than_setup.rb
gherkin_lint-0.6.0 lib/gherkin_lint/linter/background_does_more_than_setup.rb
gherkin_lint-0.5.0 lib/gherkin_lint/linter/background_does_more_than_setup.rb
gherkin_lint-0.4.4 lib/gherkin_lint/linter/background_does_more_than_setup.rb
gherkin_lint-0.4.3 lib/gherkin_lint/linter/background_does_more_than_setup.rb
gherkin_lint-0.4.2 lib/gherkin_lint/linter/background_does_more_than_setup.rb
gherkin_lint-0.4.1 lib/gherkin_lint/linter/background_does_more_than_setup.rb
gherkin_lint-0.4.0 lib/gherkin_lint/linter/background_does_more_than_setup.rb