[rspec-users] Prepare for newbie-ness
Scott Taylor
mailing_lists at railsnewbie.com
Tue Sep 16 21:11:30 EDT 2008
On Sep 16, 2008, at 3:05 PM, David Chelimsky wrote:
> On Tue, Sep 16, 2008 at 1:59 PM, Mark Wilden <mark at mwilden.com> wrote:
>> 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,
>
> Please pay no attention to that sort of bullshit :)
>
> The idea is that TDD, practiced with discipline, should make you
> depend less on a debugger. This is a good thing since debugging time
> is impossible to estimate. But the idea that you're not supposed to
> use a debugger is religious hog-wash.
Yeah - I use a debugger all the time, often using the following
snippets:
I'll insert the following right inside the spec:
it "should do something or other" do
$debug = true
some_method.should == some_value
end
Then in the implementation, I'll insert the following:
def some_method
require "ruby-debug"; debugger if $debug
...
end
This pops me right into the method. It's very convenient.
But regarding the previous comments, I'm surprised at how few actually
use debuggers. As long as you are writing specs for anything you'll
be debugging, you should be fine.
Just remember that unit testing started in smalltalk, which would
*automatically* start a debugger when an example failed....
Scott
More information about the rspec-users
mailing list