Skip to content

Debug Test Failures with Pry

Nathan Hopkins edited this page Feb 23, 2015 · 22 revisions

Pry integration is a key feature designed to change the way you test. Pry-test starts a pry session on test failures & exceptions.

We've found that automatically dropping into a pry session on test failure has sped up our development workflow. Our team loves it.

Setup

Add the following lines to your Gemfile.

gem "pry"
gem "pry-stack_explorer"
gem "pry-rescue"
gem "pry-byebug"

Then run your tests with bundle exec.

bundle exec pry-test /path/to/test/dir

Gem conflicts

Some pry related gems, like pry-exception_explorer can cause problems with PryTest's workflow. For guaranteed compatibility, remove all pry related gems from your Gemfile (other than the gems listed above).

Clone this wiki locally