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 is as ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.