Sha256: 73ac147b7e4f2178c4c5dde284ffe00bd18519364d24cfb598d4fb7fdadd0fce

Contents?: true

Size: 590 Bytes

Versions: 14

Compression:

Stored size: 590 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Minitest
      # This cop 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

14 entries across 14 versions & 1 rubygems

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