Sha256: 32bfadea349c878c670b44b127e7af5abb44b5513fd73e3e9b8235734e73430c

Contents?: true

Size: 651 Bytes

Versions: 14

Compression:

Stored size: 651 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Minitest
      # This cop enforces the test to use `assert_instance_of(Class, object)`
      # over `assert(object.instance_of?(Class))`.
      #
      # @example
      #   # bad
      #   assert(object.instance_of?(Class))
      #   assert(object.instance_of?(Class), 'message')
      #
      #   # good
      #   assert_instance_of(Class, object)
      #   assert_instance_of(Class, object, 'message')
      #
      class AssertInstanceOf < Base
        extend MinitestCopRule

        define_rule :assert, target_method: :instance_of?, inverse: true
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rubocop-minitest-0.19.1 lib/rubocop/cop/minitest/assert_instance_of.rb
rubocop-minitest-0.19.0 lib/rubocop/cop/minitest/assert_instance_of.rb
rubocop-minitest-0.18.0 lib/rubocop/cop/minitest/assert_instance_of.rb
rubocop-minitest-0.17.2 lib/rubocop/cop/minitest/assert_instance_of.rb
rubocop-minitest-0.17.1 lib/rubocop/cop/minitest/assert_instance_of.rb
rubocop-minitest-0.17.0 lib/rubocop/cop/minitest/assert_instance_of.rb
rubocop-minitest-0.16.0 lib/rubocop/cop/minitest/assert_instance_of.rb
rubocop-minitest-0.15.2 lib/rubocop/cop/minitest/assert_instance_of.rb
rubocop-minitest-0.15.1 lib/rubocop/cop/minitest/assert_instance_of.rb
rubocop-minitest-0.15.0 lib/rubocop/cop/minitest/assert_instance_of.rb
rubocop-minitest-0.14.0 lib/rubocop/cop/minitest/assert_instance_of.rb
rubocop-minitest-0.13.0 lib/rubocop/cop/minitest/assert_instance_of.rb
rubocop-minitest-0.12.1 lib/rubocop/cop/minitest/assert_instance_of.rb
rubocop-minitest-0.12.0 lib/rubocop/cop/minitest/assert_instance_of.rb