Forum: RSpec [cucumber] Where does STDOUT go?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
171ea139761951336b844e708d1547ab?d=identicon&s=25 James Byrne (byrnejb)
on 2009-04-27 22:53
If one invokes a Ruby script from a cucumber step definition and that
script contains "puts" statements then where does the output go?  I have
a script that when run from the command line displays "puts" output in
the terminal session, but when run from a cucumber step definition
produces no console output.  It does however produce the expected output
file in either case.
C694a032be7518a0d704318895f8fe1d?d=identicon&s=25 Ben Mabey (mabes)
on 2009-04-27 23:27
(Received via mailing list)
James Byrne wrote:
> If one invokes a Ruby script from a cucumber step definition and that
> script contains "puts" statements then where does the output go?  I have
> a script that when run from the command line displays "puts" output in
> the terminal session, but when run from a cucumber step definition
> produces no console output.  It does however produce the expected output
> file in either case.
>

If you are running the command with the backticks it is simply being
returned to that call.  If you want to see that ouput you could add a
puts.. for example:

puts `some_command`


If you are testing a CLI tool you may want to look how Cucumber's and
RSpec's features capture and use the STDOUT and STDERR.

http://github.com/aslakhellesoy/cucumber/blob/0e9f...

-Ben
171ea139761951336b844e708d1547ab?d=identicon&s=25 James Byrne (byrnejb)
on 2009-04-28 02:22
Ben Mabey wrote:

>
> If you are running the command with the backticks it is simply being
> returned to that call.  If you want to see that ouput you could add a
> puts.. for example:
>
> puts `some_command`
>

Thanks
4e13e53b030e7751b777e439357fe902?d=identicon&s=25 Julian Leviston (Guest)
on 2009-04-28 04:17
(Received via mailing list)
It produces console output for me.

Julian.
This topic is locked and can not be replied to.