Sha256: 47d8291e083bc35a6aee73b53edf7b41f11d3ea8620f39eae2275df69cf4c35b

Contents?: true

Size: 666 Bytes

Versions: 10

Compression:

Stored size: 666 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Minitest
      # This cop enforces the test to use `assert_includes`
      # instead of using `assert(collection.include?(object))`.
      #
      # @example
      #   # bad
      #   assert(collection.include?(object))
      #   assert(collection.include?(object), 'message')
      #
      #   # good
      #   assert_includes(collection, object)
      #   assert_includes(collection, object, 'message')
      #
      class AssertIncludes < Cop
        extend MinitestCopRule

        define_rule :assert, target_method: :include?, preferred_method: :assert_includes
      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_includes.rb
rubocop-minitest-0.11.0 lib/rubocop/cop/minitest/assert_includes.rb
rubocop-minitest-0.10.3 lib/rubocop/cop/minitest/assert_includes.rb
rubocop-minitest-0.10.2 lib/rubocop/cop/minitest/assert_includes.rb
rubocop-minitest-0.10.1 lib/rubocop/cop/minitest/assert_includes.rb
rubocop-minitest-0.10.0 lib/rubocop/cop/minitest/assert_includes.rb
rubocop-minitest-0.9.0 lib/rubocop/cop/minitest/assert_includes.rb
rubocop-minitest-0.8.1 lib/rubocop/cop/minitest/assert_includes.rb
rubocop-minitest-0.8.0 lib/rubocop/cop/minitest/assert_includes.rb
rubocop-minitest-0.7.0 lib/rubocop/cop/minitest/assert_includes.rb