Sha256: ec4fd945fa7b32b56205586a9f8bf63c019c6178e833c75f263fa1a3647a3173

Contents?: true

Size: 567 Bytes

Versions: 2

Compression:

Stored size: 567 Bytes

Contents

require 'chutney/linter'

module Chutney
  # service class to lint for tags used multiple times
  class ScenarioNamesMatch < Linter
    MESSAGE = 'Scenario Name does not match pattern'.freeze
  

    def lint
      scenarios do |file, feature, scenario|
        name = scenario.key?(:name) ? scenario[:name].strip : ''
        references = [reference(file, feature, scenario)]
        next unless (name =~ /#{@pattern}/).nil?
        
        add_warning(references, MESSAGE)
      end
    end
    
    def matcher(pattern)
      @pattern = pattern
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chutney-1.6.3 lib/chutney/linter/scenario_names_match.rb
chutney-1.6.2 lib/chutney/linter/scenario_names_match.rb