Sha256: 32af22e22fe7a97d481c78c9f8c63aae19a556544e2bbd76a44f92dd0e2705eb

Contents?: true

Size: 577 Bytes

Versions: 5

Compression:

Stored size: 577 Bytes

Contents

require 'chutney/linter'

module Chutney
  # service class for check that there are multiple scenarios once a background is used
  class BackgroundRequiresMultipleScenarios < Linter
    MESSAGE = 'Avoid using Background steps for just one scenario'.freeze
  
    def lint
      backgrounds do |file, feature, background|
        scenarios = feature[:children].reject { |element| element[:type] == :Background }
        next if scenarios.length >= 2

        references = [reference(file, feature, background)]
        add_error(references, MESSAGE)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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