lib/rubocop/cop/minitest/assert_kind_of.rb in rubocop-minitest-0.34.4 vs lib/rubocop/cop/minitest/assert_kind_of.rb in rubocop-minitest-0.34.5
- old
+ new
@@ -9,17 +9,22 @@
# @example
# # bad
# assert(object.kind_of?(Class))
# assert(object.kind_of?(Class), 'message')
#
+ # # bad
+ # # `is_a?` is an alias for `kind_of?`
+ # assert(object.is_a?(Class))
+ # assert(object.is_a?(Class), 'message')
+ #
# # good
# assert_kind_of(Class, object)
# assert_kind_of(Class, object, 'message')
#
class AssertKindOf < Base
extend MinitestCopRule
- define_rule :assert, target_method: :kind_of?, inverse: true
+ define_rule :assert, target_method: %i[kind_of? is_a?], preferred_method: :assert_kind_of, inverse: true
end
end
end
end