class ActiveModel::Error

def match?(attribute, type = nil, **options)

Omitted params are not checked for a match.

See if error matches provided +attribute+, +type+, and +options+.
def match?(attribute, type = nil, **options)
  if @attribute != attribute || (type && @type != type)
    return false
  end
  options.each do |key, value|
    if @options[key] != value
      return false
    end
  end
  true
end