This could be much shorter:

    errors.add(:base, "path is mandatory for a matcher and must be a string") unless path.present?