Sha256: ff5b2bb08e870bf06659f56bdc6ab41615ae96f6a99c892909a8b9d1c95e77ee

Contents?: true

Size: 764 Bytes

Versions: 10

Compression:

Stored size: 764 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Minitest
      # This cop enforces the use of `assert_respond_to(object, :do_something)`
      # over `assert(object.respond_to?(:do_something))`.
      #
      # @example
      #   # bad
      #   assert(object.respond_to?(:do_something))
      #   assert(object.respond_to?(:do_something), 'message')
      #   assert(respond_to?(:do_something))
      #
      #   # good
      #   assert_respond_to(object, :do_something)
      #   assert_respond_to(object, :do_something, 'message')
      #   assert_respond_to(self, :do_something)
      #
      class AssertRespondTo < Cop
        extend MinitestCopRule

        define_rule :assert, target_method: :respond_to?
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rubocop-minitest-0.11.1 lib/rubocop/cop/minitest/assert_respond_to.rb
rubocop-minitest-0.11.0 lib/rubocop/cop/minitest/assert_respond_to.rb
rubocop-minitest-0.10.3 lib/rubocop/cop/minitest/assert_respond_to.rb
rubocop-minitest-0.10.2 lib/rubocop/cop/minitest/assert_respond_to.rb
rubocop-minitest-0.10.1 lib/rubocop/cop/minitest/assert_respond_to.rb
rubocop-minitest-0.10.0 lib/rubocop/cop/minitest/assert_respond_to.rb
rubocop-minitest-0.9.0 lib/rubocop/cop/minitest/assert_respond_to.rb
rubocop-minitest-0.8.1 lib/rubocop/cop/minitest/assert_respond_to.rb
rubocop-minitest-0.8.0 lib/rubocop/cop/minitest/assert_respond_to.rb
rubocop-minitest-0.7.0 lib/rubocop/cop/minitest/assert_respond_to.rb