[rspec-users] autotest debugger?

Jamal Soueidan lists at ruby-forum.com
Fri Nov 2 04:48:52 EDT 2007


Scott Taylor wrote:
> On Nov 1, 2007, at 6:18 AM, Jamal Soueidan wrote:
> 
>> @user.errors.on(:email).should_not be_empty
>>
>> ...throws error failure
>>
> 
> This is not an autotest problem, this is a test problem.
> 
> Usually I start adding extra tests:
> 
> it "should not raise an error with a new user (exploratory test)" do
>   lambda {
>     User.new
>   }.should_not raise_error
> end
> 
> If that one fails...then it's a problem with my setup (before
> (:each))...and so on.
> 
> If I really have no idea what's going on, I'll insert the following
> snippet to the top of the spec:
> 
> require 'rubygems'; require 'ruby-debug'; debugger;
> 
> (I use textmate, and have a snippet setup so that I can type "debug"
> tab, and the full line gets inserted)
> 
> The next time autotest runs, it will drop me into the debugger (make
> sure you have the ruby-debug gem installed).
> 
> Hope that helps,
> 
> Scott

I tried to insert the requiring files etc. and went into the debugger, 
but how do I use it ?

$ autotest
loading autotest/rails_rspec
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -S 
script/spec -O spec/spec.opts  spec/controllers/user_controller_spec.rb 
spec/models/user_spec.rb spec/helpers/user_helper_spec.rb 
spec/controllers/video_controller_spec.rb 
spec/helpers/video_helper_spec.rb
./spec/controllers/user_controller_spec.rb:5 require 
File.dirname(__FILE__) + '/../spec_helper'
(rdb:1) user = User.new
Adjusting would put us beyond the oldest (initial) frame.
(rdb:1) user.email = "test"
Adjusting would put us beyond the oldest (initial) frame.
(rdb:1) user.should_not be_valid
Adjusting would put us beyond the oldest (initial) frame.
(rdb:1)
-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list