FWIW, given that you are using `StringIO` objects, you don't need to do `stream.rewind; stream.read`.  You can just use `stream.string` -- `StringIO` exposes the entire thing from that method.  It would cleanup this spec code a lot given all the places where rewind/read is being used.