livinginthepast/fake_ftp — pull request #12 by Pranas (2012-09-09 19:57:19+00:00)
Title: Allow upload streams

Hi

I use fake_ftp to test my ftp uploader. Thanks for this gem!

I've encountered bug which led to my tests failing randomly. I'm generating data on fly and using ``Net::FTP#storlines`` to immediately send that data to ftp server.

I found out that ``TCPSocket#recv`` doesn't wait for connection to close or buffer to fill up but returns immediately when it receives something. Sometimes it manages to read all my data and sometimes only the first stream. ``TCPSocket#read`` returns after connection is closed or buffer is full. Changing from ``recv`` to ``read`` fixed my issue.

I've added test that covers this case.