Sha256: fc82a382a6e1b05898a5e016cb645deac1fae05f1f2c755fdc359fc3fe6e3744

Contents?: true

Size: 791 Bytes

Versions: 3

Compression:

Stored size: 791 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Minitest
      # This cop 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

3 entries across 3 versions & 1 rubygems

Version Path
rubocop-minitest-0.19.1 lib/rubocop/cop/minitest/refute_predicate.rb
rubocop-minitest-0.19.0 lib/rubocop/cop/minitest/refute_predicate.rb
rubocop-minitest-0.18.0 lib/rubocop/cop/minitest/refute_predicate.rb