Breakpoint prefered way to debug?

Hi,

I am using rails 1.1.6 and ruby 1.8.4 (on ubuntu). In my unit test, I
have this code:
def test_add_translations
maison = Term.find_by_term(‘maison’)
breakpoint “maison”
end

and when I get to the breakpoint session, I have no access to the
local variable. I know there’s a problem with breakpoint and ruby
1.8.5, but it should work with 1.8.4 (from my understanding).

So, is there a workaround? I’d prefer to continue working with my
distribution’s ruby. Or should I use another debugging method like
ruby-debug?

Raph

Honestly, for unit testing, I just use puts

def test_add_translations
maison = Term.find_by_term(‘maison’)
puts maison
end

It will appear in my test window. To speed the process, I use ZenTest so
my
tests run when I save them

On 12/15/06, Raphael B. [email protected] wrote:

Hi,

I am using rails 1.1.6 and ruby 1.8.4 (on ubuntu). In my unit test, I

I’ve installed ruby1.8.5 and get the same problem:

irb(test_add_translations(TermTest)):001:0> maison
NameError: undefined local variable or method maison' for #<TermTest:0xb75a11f0> from /home/xx/rails/config/../vendor/rails/actionpack/lib/action_controller/test_process.rb:432:in method_missing’
from (irb):1:in breakpoint' from /home/xx/rails/config/../vendor/rails/railties/lib/breakpoint.rb:512:in breakpoint’
from
/home/xx/rails/config/…/vendor/rails/railties/lib/breakpoint.rb:512:in
breakpoint' from term_test.rb:48:in test_add_translations’
from /usr/lib/ruby/1.8/test/unit/testcase.rb:78:in __send__' from /usr/lib/ruby/1.8/test/unit/testcase.rb:78:in run’
from /usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in run' from /usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in each’
from /usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in run' from /usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in run’
from /usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in each' from /usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in run’
from /usr/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:in
run_suite' from /usr/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:67:in start_mediator’
from /usr/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:41:in
start' from /usr/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:29:in run’
from /usr/lib/ruby/1.8/test/unit/autorunner.rb:200:in run' from /usr/lib/ruby/1.8/test/unit/autorunner.rb:13:in run’
from /usr/lib/ruby/1.8/test/unit.rb:278
from term_test.rb:46irb(test_add_translations(TermTest)):002:0>

Raph

So, is there a workaround? I’d prefer to continue working with my
distribution’s ruby. Or should I use another debugging method like
ruby-debug?

Raph


Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org

my work around for the error is to change the variable type
(temporarily):

def test_add_translations
maison = Term.find_by_term(‘maison’)
@m = maison
breakpoint
end

then, when the test hits the breakpoint, you should be able to just
type @m to see the value…
dumb, but it works. i only do this if i need to do something with
the variable other than see it’s value. otherwise, a puts works ok.

Ed Hickey
Developer
Litmus Media
816-533-0409
[email protected]
A Member of Think Partnership, Inc
www.ThinkPartnership.com
Amex ticker symbol: THK

On 12/15/06, Raphael B. [email protected] wrote:

#TermTest:0xb75a11f0
from /usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in run' from /usr/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:29:in run’

maison = Term.find_by_term('maison')

Raph


Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org

On 12/15/06, Ed Hickey [email protected] wrote:

type @m to see the value…
dumb, but it works. i only do this if i need to do something with
the variable other than see it’s value. otherwise, a puts works ok.

I’ll do that too then. I hoped there was a way to have access to local
variables. Is there a reason why it has no more access to local
variables?

Thanks

Raph

NameError: undefined local variable or method maison' for from /usr/lib/ruby/1.8/test/unit/testcase.rb:78:in run’
from /usr/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:41:in `start’

def test_add_translations
ruby-debug?


Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org