Sha256: c39d9480ee5eac14ef5a44471c65a5d011865e840984ef703fa86a7ada863748

Contents?: true

Size: 667 Bytes

Versions: 14

Compression:

Stored size: 667 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 < Base
        extend MinitestCopRule

        define_rule :assert, target_method: :include?, preferred_method: :assert_includes
      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_includes.rb
rubocop-minitest-0.19.0 lib/rubocop/cop/minitest/assert_includes.rb
rubocop-minitest-0.18.0 lib/rubocop/cop/minitest/assert_includes.rb
rubocop-minitest-0.17.2 lib/rubocop/cop/minitest/assert_includes.rb
rubocop-minitest-0.17.1 lib/rubocop/cop/minitest/assert_includes.rb
rubocop-minitest-0.17.0 lib/rubocop/cop/minitest/assert_includes.rb
rubocop-minitest-0.16.0 lib/rubocop/cop/minitest/assert_includes.rb
rubocop-minitest-0.15.2 lib/rubocop/cop/minitest/assert_includes.rb
rubocop-minitest-0.15.1 lib/rubocop/cop/minitest/assert_includes.rb
rubocop-minitest-0.15.0 lib/rubocop/cop/minitest/assert_includes.rb
rubocop-minitest-0.14.0 lib/rubocop/cop/minitest/assert_includes.rb
rubocop-minitest-0.13.0 lib/rubocop/cop/minitest/assert_includes.rb
rubocop-minitest-0.12.1 lib/rubocop/cop/minitest/assert_includes.rb
rubocop-minitest-0.12.0 lib/rubocop/cop/minitest/assert_includes.rb