Debugging Specs

Posted on Sun Feb 17 00:11:00 UTC 2008

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…

Posted in Rails, Testing  |  Tags ,  |  1 comment

Comments

  1. Alicia Alicia said // Feb 17, 2008 at 06:45 AM

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

(leave url/email »)

Comment Markup Help