Pry

Once upon a time, I was a big fan of development environments that had big fancy symbolic debuggers that let you set breakpoints and watch variables and step through the code.

What can I say? I was young and programming in Java.

When I started using TDD, I largely stopped using debuggers. Having small, focused tests eliminates most of the need to walk through code in a step debugger. That said, it’s sometimes nice to be able to stop a test in progress and peer inside the Ruby virtual machine to see what’s going on.

Enter Pry.

Pry is technically a Ruby console—a souped-up replacement for irb, but with some add-on gems. It makes an excellent debugger. You can even coax it to reload code changes and rerun specs from inside Pry, which ...

Get Rails 4 Test Prescriptions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.