Thanks for the reply. I had seen that a few days ago but didn't think it was helpful...perhaps I did not use it correctly. It felt like whatever I wrote, it just approved. Basically I have a command I am running and I want to see what it's stdout is to see for some of my tests why it is not matching my expectation. See attached image for what I am trying to do.
On Wednesday, June 24, 2015 at 1:42:57 PM UTC-4, Myron Marston wrote: > > On Wednesday, June 24, 2015 at 6:18:02 AM UTC-7, Laurence Rosenzweig wrote: >> >> >> >> On Wednesday, June 24, 2015 at 9:14:58 AM UTC-4, Laurence Rosenzweig >> wrote: >>> >>> I have been running Rspec tests and want to print out STDOUT. It seems >>> like a very simple problem yet I see very little documentation about this >>> issue and I have been unable to figure out how to print it. I know as a >>> variable you can do $stdout but whenever I print it (using pp, puts, or >>> print), I cannot get the actual value of stdout. >>> >>> >>> >>> I attached an image of one of my tests with a few of my different >>> attempts (commented out at the moment). >>> >>> >>> >>> Thanks for your help! >>> >> > > Ruby's `$stdout` doesn't provide you with what has been written to stdout. > It's an IO object that can be written to but not read from. If you want > to set an expectation about what has been written to stdout, we have a > matcher for that: > > > https://relishapp.com/rspec/rspec-expectations/v/3-3/docs/built-in-matchers/output-matcher > > HTH, > Myron > > > -- You received this message because you are subscribed to the Google Groups "rspec" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/f2b776fa-011b-4ddb-ba37-0be4025d3e85%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
