Method capture

Showing 1-6 of 6 messages
Method capture Dmitry Vorotilin 9/10/12 8:56 AM
Guys I want to ask you about current realization of method capture. There's a case in tests where I want to capture output in subprocess, current realization cannot do it because it doesn't reopen $std{out,err} and just reassign this value. I think that's enough for many cases, do we need another realization in reporting.rb? Or I can just place it in the tests. It related to https://github.com/rails/rails/pull/7586
Re: [Rails-core] Method capture Aaron Patterson 9/10/12 9:26 AM
Can you check to see if minitest's `capture_io` will solve the problem?

  https://github.com/seattlerb/minitest/blob/master/lib/minitest/unit.rb#L447-460

If not, can you write a small example (outside rails) to demonstrate the
problem?  This sounds like something we might want to push up to
minitest if possible.

--
Aaron Patterson
http://tenderlovemaking.com/
Re: [Rails-core] Method capture Dmitry Vorotilin 9/10/12 2:38 PM
Thanks Aaron for reply I write a gist for these cases, here you are https://gist.github.com/3694068
Re: [Rails-core] Method capture Dmitry Vorotilin 9/10/12 2:41 PM
The new method, captures all descriptors, but I'm not sure about replacement original method.
Re: [Rails-core] Method capture Gabriel Sobrinho 9/11/12 6:24 AM
Dmitry,

I commented in your gist to use the StringIO instead of Tempfile to avoid IO on disk.
Re: [Rails-core] Method capture Dmitry Vorotilin 9/11/12 9:41 AM
Thank you, let's discuss it in PR https://github.com/seattlerb/minitest/pull/161
I think it will be more comfortable for us.