How to access stdout or stderr in Capybara integration test

I am trying to debug some Capybara integration tests and run into an unforeseen problem. When I set a breakpoint in the Capybara test, I can check the variables, but I can't call puts or $stdout.puts or $stderr.puts . To understand what I mean, look at this conclusion:

 (rdb:1) "foo" "foo" (rdb:1) puts "foo" nil 

Presumably this is due to the fact that Capybara commits both stderr and stdout as part of the standard operation to keep calm with selenium drivers, etc. I understand, but the problem is that checking the lines in the ruby ​​debugger escapes new lines, which makes it impossible to read long formatted lines, such as HTML.

How can I get a link to the active terminal to output something for debugging purposes using IO#puts ?

+4
source share
1 answer

You might have taken a look at Capybara-cli, which will help make debugging this way.

https://github.com/vspy/capybara-console

0
source

Source: https://habr.com/ru/post/1397889/


All Articles