Debugging Specs

It is easy enough to debug specs on by one. For this you just run the ruby file that contains the spec with ruby-debug instead of ruby:

rdebug spec/rur_spec.rb

But when running via rake, you can’t do this. A simple solution is to add these lines in the spec file you want to debug (or in spec_helper.rb):

require_library_or_gem 'ruby-debug'
Debugger.start

And you are in business…

Tags: ,

One Response to “Debugging Specs”

  1. Alicia February 17, 2008 at 8:11 am #

    This is a good debugging technique. Makes everything much simpler.