Sha256: 0d598c01a4599465ced45b14701f1e85b9b51a3d0a19dbdb0a76d3a5bd5640b6

Contents?: true

Size: 606 Bytes

Versions: 12

Compression:

Stored size: 606 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, inverse: 'regexp_type?'
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rubocop-minitest-0.27.0 lib/rubocop/cop/minitest/assert_match.rb
rubocop-minitest-0.26.1 lib/rubocop/cop/minitest/assert_match.rb
rubocop-minitest-0.26.0 lib/rubocop/cop/minitest/assert_match.rb
rubocop-minitest-0.25.1 lib/rubocop/cop/minitest/assert_match.rb
rubocop-minitest-0.25.0 lib/rubocop/cop/minitest/assert_match.rb
rubocop-minitest-0.24.0 lib/rubocop/cop/minitest/assert_match.rb
rubocop-minitest-0.23.2 lib/rubocop/cop/minitest/assert_match.rb
rubocop-minitest-0.23.1 lib/rubocop/cop/minitest/assert_match.rb
rubocop-minitest-0.23.0 lib/rubocop/cop/minitest/assert_match.rb
rubocop-minitest-0.22.2 lib/rubocop/cop/minitest/assert_match.rb
rubocop-minitest-0.22.1 lib/rubocop/cop/minitest/assert_match.rb
rubocop-minitest-0.22.0 lib/rubocop/cop/minitest/assert_match.rb