Sha256: 8eaba1b9273d1e953aad9e6f26719ce4f623eacf09d6a461fb6fe4875a02bfbd

Contents?: true

Size: 761 Bytes

Versions: 34

Compression:

Stored size: 761 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Minitest
      # Enforces the test to use `refute_respond_to(object, :do_something)`
      # over `refute(object.respond_to?(:do_something))`.
      #
      # @example
      #   # bad
      #   refute(object.respond_to?(:do_something))
      #   refute(object.respond_to?(:do_something), 'message')
      #   refute(respond_to?(:do_something))
      #
      #   # good
      #   refute_respond_to(object, :do_something)
      #   refute_respond_to(object, :do_something, 'message')
      #   refute_respond_to(self, :do_something)
      #
      class RefuteRespondTo < Base
        extend MinitestCopRule

        define_rule :refute, target_method: :respond_to?
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
rubocop-minitest-0.26.0 lib/rubocop/cop/minitest/refute_respond_to.rb
rubocop-minitest-0.25.1 lib/rubocop/cop/minitest/refute_respond_to.rb
rubocop-minitest-0.25.0 lib/rubocop/cop/minitest/refute_respond_to.rb
rubocop-minitest-0.24.0 lib/rubocop/cop/minitest/refute_respond_to.rb
rubocop-minitest-0.23.2 lib/rubocop/cop/minitest/refute_respond_to.rb
rubocop-minitest-0.23.1 lib/rubocop/cop/minitest/refute_respond_to.rb
rubocop-minitest-0.23.0 lib/rubocop/cop/minitest/refute_respond_to.rb
rubocop-minitest-0.22.2 lib/rubocop/cop/minitest/refute_respond_to.rb
rubocop-minitest-0.22.1 lib/rubocop/cop/minitest/refute_respond_to.rb
rubocop-minitest-0.22.0 lib/rubocop/cop/minitest/refute_respond_to.rb
rubocop-minitest-0.21.1 lib/rubocop/cop/minitest/refute_respond_to.rb
rubocop-minitest-0.21.0 lib/rubocop/cop/minitest/refute_respond_to.rb
rubocop-minitest-0.20.1 lib/rubocop/cop/minitest/refute_respond_to.rb
rubocop-minitest-0.20.0 lib/rubocop/cop/minitest/refute_respond_to.rb