I'm trying to debug some Capybara integration tests and running into an unexpected issue. When I set a breakpoint inside a Capybara test, I can inspect variables, but i can not call puts
or $stdout.puts
or $stderr.puts
. To understand what I mean look at this output:
(rdb:1) "foo"
"foo"
(rdb:1) puts "foo"
nil
Presumably this is because Capybara captures both stderr and stdout as part of its standard operation in order to keep things quiet with selenium drivers, etc. I get that, but the problem is that inspecting strings in the ruby debugger escapes newlines, which makes it impossible to read long formatted strings like HTML.
How can I get a reference to the active terminal to output something for debugging purposes using IO#puts
?