Sha256: 06ccab3a379065cca31ef784ce7143efeb7ecbede08a089c939f96c126824de3

Contents?: true

Size: 608 Bytes

Versions: 2

Compression:

Stored size: 608 Bytes

Contents

require 'gherkin_lint/linter'

module GherkinLint
  # service class to lint for bad scenario names
  class BadScenarioName < Linter
    def lint
      scenarios do |file, feature, scenario|
        next if scenario['name'].empty?
        references = [reference(file, feature, scenario)]
        description = 'Prefer to rely just on Given and When steps when name your scenario to keep it stable'
        bad_words = %w(test verif check)
        bad_words.each do |bad_word|
          add_error(references, description) if scenario['name'].downcase.include? bad_word
        end
      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/bad_scenario_name.rb
gherkin_lint-0.3.0 lib/gherkin_lint/linter/bad_scenario_name.rb