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

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

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
ehickey@litmusmedia.com
A Member of Think Partnership, Inc
www.ThinkPartnership.com
Amex ticker symbol: THK

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.

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