Sha256: 0ec3524c71af650851f5d7094122b9847decdcbc56096fff803a5eca50661d39

Contents?: true

Size: 623 Bytes

Versions: 5

Compression:

Stored size: 623 Bytes

Contents

require 'chutney/linter'

module Chutney
  # service class to lint for avoiding outline for single example
  class AvoidOutlineForSingleExample < Linter
    def lint
      scenarios do |file, feature, scenario|
        next unless scenario[:type] == :ScenarioOutline

        next unless scenario.key? :examples
        next if scenario[:examples].length > 1
        next if scenario[:examples].first[:tableBody].length > 1

        references = [reference(file, feature, scenario)]
        add_error(references, 'You have a Scenarion Outline with a single example - rewrite to use a Scenario')
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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