Sha256: a6f7fe31fdd5fc0d7040fc162a56b009c3dc46b39fd19724a2f1e3db28ea34f3

Contents?: true

Size: 760 Bytes

Versions: 8

Compression:

Stored size: 760 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Minitest
      # Enforces the test to use `refute_match`
      # instead of using `refute(matcher.match(string))`.
      #
      # @example
      #   # bad
      #   refute(matcher.match(string))
      #   refute(matcher.match?(string))
      #   refute(matcher =~ string)
      #   refute(matcher.match(string), 'message')
      #
      #   # good
      #   refute_match(matcher, string)
      #   refute_match(matcher, string, 'message')
      #
      class RefuteMatch < Base
        extend MinitestCopRule

        define_rule :refute, target_method: %i[match match? =~],
                             preferred_method: :refute_match, inverse: 'regexp_type?'
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rubocop-minitest-0.32.2 lib/rubocop/cop/minitest/refute_match.rb
rubocop-minitest-0.32.1 lib/rubocop/cop/minitest/refute_match.rb
rubocop-minitest-0.32.0 lib/rubocop/cop/minitest/refute_match.rb
rubocop-minitest-0.31.1 lib/rubocop/cop/minitest/refute_match.rb
rubocop-minitest-0.31.0 lib/rubocop/cop/minitest/refute_match.rb
rubocop-minitest-0.30.0 lib/rubocop/cop/minitest/refute_match.rb
rubocop-minitest-0.29.0 lib/rubocop/cop/minitest/refute_match.rb
rubocop-minitest-0.28.0 lib/rubocop/cop/minitest/refute_match.rb