Sha256: 57cd7d8441d19b40f9faa81c21b209e5e8e4ccc9e87cd1e005d072f3f065cc84

Contents?: true

Size: 782 Bytes

Versions: 2

Compression:

Stored size: 782 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

        private

        def assertion_type
          'refute'
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubocop-minitest-0.20.1 lib/rubocop/cop/minitest/refute_predicate.rb
rubocop-minitest-0.20.0 lib/rubocop/cop/minitest/refute_predicate.rb