In the past I’ve always used ruby-debug (or more recently debugger) to set breakpoints and debug my rails integration tests built with Capybara and Selenium. A problem I’ve continually run into is that when the debugger launches it suspends all threads, including both the thread Capybara is running on as well as the rails server thread, so when trying to do something with Capybara that requires a server response it just times out.
Just to verify this behavior of ruby-debug/debugger, you can try:
sleep 2to pass some time, the separate thread will stay suspended, and it’ll only actually print “done!” once you exit the debugger.
Use a REPL instead
The suspended threads issue can be avoided entirely by using a REPL (read-evaluate-print loop) instead of a breakpoint. Doing this with IRB requires some trickery to get the context right, but with Pry it’s super easy: