Re: [rspec] redirect to stderr

2021-12-12 Thread Phil Pirozhkov
If you stick to a convention that you output debug messages to stderr and pipeable program output goes to stdout, it will be easier to separate the two. For better or worse, RSpec outputs to stdout. On Sat, Dec 11, 2021 at 9:50 PM Joao Miguel Ferreira < joao.miguel.c.ferre...@gmail.com> wrote: >

Re: [rspec] redirect to stderr

2021-12-12 Thread Jon Rowe
Hello RSpec tries not to monkey patch standard Ruby methods, so `puts` etc will always try to output to `$stdout`, we do provide a matcher which redirects `$stdout` and/or `$stderr` to a `StringIO` temporarily, which can be used as: ``` expect { code }.to output.to_stdout # and/or `to_stderr`