[rspec-users] Prepare for newbie-ness

Mark Wilden mark at mwilden.com
Tue Sep 16 14:59:41 EDT 2008


On Tue, Sep 16, 2008 at 10:00 AM, Martin Streicher <
martin.streicher at gmail.com> wrote:

>
> 3/ Has any documented how to run the debugger via rspec to help track down
> errors?
>

We TDD/BDD/Agile practitioners aren't supposed to use a debugger, so don't
tell anyone I said this. But all I have to do (on a Mac system) is to
install the ruby-debug gem, then insert

 require 'ruby-debug'
 debugger

at the point in my code where I want to break into the debugger. Then
running the specs via most any means (including autotest, but not
spec_server) will start up the debugger at that point. Frankly, though, I'll
often just stick in some p statements to show some data. Actually, I use
this little function:

  def l &block
    name = block.call
    puts name + ' = ' + eval(name, block).inspect
  end

which, when called like 'l{'foo'}' prints 'foo = ' followed by the value of
foo.

But these are pretty brute-force techniques, so we'll just keep it our
little secret.

///ark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20080916/c7945a74/attachment.html>


More information about the rspec-users mailing list