Sha256: 86d964bb7c531950889d7da3e4b985a79a65930f923c9489636bd2dea85770c9

Contents?: true

Size: 570 Bytes

Versions: 14

Compression:

Stored size: 570 Bytes

Contents

# frozen_string_literal: true

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'

    def lint
      background do |feature, background|
        next unless background
        next unless feature&.tests
        next if feature.tests.length >= 2

        add_issue(I18n.t('linters.background_requires_multiple_scenarios'), feature, background)
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
chutney-3.9.0 lib/chutney/linter/background_requires_multiple_scenarios.rb
chutney-3.8.2 lib/chutney/linter/background_requires_multiple_scenarios.rb
chutney-3.8.1 lib/chutney/linter/background_requires_multiple_scenarios.rb
chutney-3.8.0 lib/chutney/linter/background_requires_multiple_scenarios.rb
chutney-3.7.0 lib/chutney/linter/background_requires_multiple_scenarios.rb
chutney-3.6.0 lib/chutney/linter/background_requires_multiple_scenarios.rb
chutney-3.5.0 lib/chutney/linter/background_requires_multiple_scenarios.rb
chutney-3.3.0 lib/chutney/linter/background_requires_multiple_scenarios.rb
chutney-3.2.1 lib/chutney/linter/background_requires_multiple_scenarios.rb
chutney-3.2.0 lib/chutney/linter/background_requires_multiple_scenarios.rb
chutney-3.1.1 lib/chutney/linter/background_requires_multiple_scenarios.rb
chutney-3.1.0 lib/chutney/linter/background_requires_multiple_scenarios.rb
chutney-3.0.1 lib/chutney/linter/background_requires_multiple_scenarios.rb
chutney-3.0.0 lib/chutney/linter/background_requires_multiple_scenarios.rb