Sha256: 53b74c963541d77e716a32229e8b7824150a3c9072bebfd2cbca32925bd44fba

Contents?: true

Size: 838 Bytes

Versions: 32

Compression:

Stored size: 838 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Minitest
      # Enforces the test to use `refute_predicate`
      # instead of using `refute(obj.a_predicate_method?)`.
      #
      # @example
      #   # bad
      #   refute(obj.one?)
      #   refute(obj.one?, 'message')
      #
      #   # good
      #   refute_predicate(obj, :one?)
      #   refute_predicate(obj, :one?, 'message')
      #
      class RefutePredicate < Base
        include ArgumentRangeHelper
        include PredicateAssertionHandleable
        extend AutoCorrector

        MSG = 'Prefer using `refute_predicate(%<new_arguments>s)`.'
        RESTRICT_ON_SEND = %i[refute].freeze # rubocop:disable InternalAffairs/UselessRestrictOnSend

        private

        def assertion_type
          'refute'
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
rubocop-minitest-0.36.0 lib/rubocop/cop/minitest/refute_predicate.rb
rubocop-minitest-0.35.1 lib/rubocop/cop/minitest/refute_predicate.rb
rubocop-minitest-0.35.0 lib/rubocop/cop/minitest/refute_predicate.rb
rubocop-minitest-0.34.5 lib/rubocop/cop/minitest/refute_predicate.rb
rubocop-minitest-0.34.4 lib/rubocop/cop/minitest/refute_predicate.rb
rubocop-minitest-0.34.3 lib/rubocop/cop/minitest/refute_predicate.rb
rubocop-minitest-0.34.2 lib/rubocop/cop/minitest/refute_predicate.rb
rubocop-minitest-0.34.1 lib/rubocop/cop/minitest/refute_predicate.rb
rubocop-minitest-0.34.0 lib/rubocop/cop/minitest/refute_predicate.rb
rubocop-minitest-0.33.0 lib/rubocop/cop/minitest/refute_predicate.rb
rubocop-minitest-0.32.2 lib/rubocop/cop/minitest/refute_predicate.rb
rubocop-minitest-0.32.1 lib/rubocop/cop/minitest/refute_predicate.rb
rubocop-minitest-0.32.0 lib/rubocop/cop/minitest/refute_predicate.rb
rubocop-minitest-0.31.1 lib/rubocop/cop/minitest/refute_predicate.rb
rubocop-minitest-0.31.0 lib/rubocop/cop/minitest/refute_predicate.rb
rubocop-minitest-0.30.0 lib/rubocop/cop/minitest/refute_predicate.rb
rubocop-minitest-0.29.0 lib/rubocop/cop/minitest/refute_predicate.rb
rubocop-minitest-0.28.0 lib/rubocop/cop/minitest/refute_predicate.rb
rubocop-minitest-0.27.0 lib/rubocop/cop/minitest/refute_predicate.rb
rubocop-minitest-0.26.1 lib/rubocop/cop/minitest/refute_predicate.rb