Sha256: 36f32d18cc3b3598dfaf9037a93a0280c78cb6132c2c626f388a3a636d15136d

Contents?: true

Size: 581 Bytes

Versions: 4

Compression:

Stored size: 581 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Minitest
      # Enforces the test to use `assert_match`
      # instead of using `assert(matcher.match(string))`.
      #
      # @example
      #   # bad
      #   assert(matcher.match(string))
      #   assert(matcher.match(string), 'message')
      #
      #   # good
      #   assert_match(regex, string)
      #   assert_match(matcher, string, 'message')
      #
      class AssertMatch < Base
        extend MinitestCopRule

        define_rule :assert, target_method: :match
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-minitest-0.21.1 lib/rubocop/cop/minitest/assert_match.rb
rubocop-minitest-0.21.0 lib/rubocop/cop/minitest/assert_match.rb
rubocop-minitest-0.20.1 lib/rubocop/cop/minitest/assert_match.rb
rubocop-minitest-0.20.0 lib/rubocop/cop/minitest/assert_match.rb