Sha256: 945b9d27201d7252a717bf4fee632c95b31c67e7ed698bd1af761ab01d65f98a

Contents?: true

Size: 663 Bytes

Versions: 5

Compression:

Stored size: 663 Bytes

Contents

require 'chutney/linter'

module Chutney
  # service class to lint for missing example names
  class MissingExampleName < Linter
    MESSAGE = 'You have an unnamed or ambiguously named example'.freeze
  
    def lint
      scenarios do |file, feature, scenario|
        next unless scenario.key? :examples
        next unless scenario[:examples].length > 1
        
        scenario[:examples].each do |example|
          name = example.key?(:name) ? example[:name].strip : ''
          next unless name.empty?
          
          references = [reference(file, feature, scenario)]
          add_error(references, MESSAGE)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
chutney-1.6.3 lib/chutney/linter/missing_example_name.rb
chutney-1.6.2 lib/chutney/linter/missing_example_name.rb
chutney-1.6.1 lib/chutney/linter/missing_example_name.rb
chutney-1.6.0 lib/chutney/linter/missing_example_name.rb
chutney-0.5.0 lib/chutney/linter/missing_example_name.rb