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/4cb9c7f2-9525-409e-af3d-533f3eb71de2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to