Search code examples
rubyrspecsinatraruby-debug

ruby-debug not finding variables in rspec (in sinatra)


In my Gemfile I have (as per https://stackoverflow.com/a/8351945/111884)

gem 'ruby-debug19', :require => 'ruby-debug'

In my spec_helper.rb I have

require 'ruby-debug'

But when I put in debugger in my spec files, I can't seem to access any variables. I get errors like:

(rdb:1) @project
*** Unknown command: "@project".  Try "help".

I've had it work on another computer before, but I can't check on that at the moment. Any ideas?


Solution

  • try to type:

    (rdb:1) p @project
    

    Debugger is not irb, it works with commands. So you should type command first. p means print, then type what you want to print. To see full list of commands, just type help.