Problem debugging while using rspec
I am having a problem debugging while using rspec. I can debug the script if I run it directly. I can stop at breakpoints, step through code, etc. If I debug with breakpoints in the same place but invoke the script through an rspec test spec, the breakpoints don't work and I get either a segmentation fault or an error code when the program terminates. If I run the rspec test script or the script, they function as expected. The problem is just with debugging. The scripts are attached.
Ideas?
Attachment(s):
test_spec.rb.zip
test_class.rb.zip
请先登录再写评论。
I should have mentioned that this is on an XP system running 2.0 beta 2.
Thanks
In my case it works on MacOS

It means that you've faced with ruby-debug gem bug. Which versions of ruby-debug-base, ruby-debug-ide do you use?
My gems are:
rspec (1.2.9)
ruby-debug (0.10.3)
ruby-debug-base (0.10.3)
ruby-debug-ide (0.4.9)
RubyGems Environment:
RUBYGEMS VERSION: 1.3.4
RUBY VERSION: 1.8.7 (2008-08-11 patchlevel 72) [i386-mswin32]
INSTALLATION DIRECTORY: C:/ruby/lib/ruby/gems/1.8
RUBY EXECUTABLE: C:/ruby/bin/ruby.exe
EXECUTABLE DIRECTORY: C:/ruby/bin
RUBYGEMS PLATFORMS:
ruby
x86-mswin32-60
GEM PATHS:
C:/ruby/lib/ruby/gems/1.8
C:/Documents and Settings/HP_Administrator/.gem/ruby/1.8
GEM CONFIGURATION:
:update_sources => true
:verbose => true
:benchmark => false
:backtrace => false
:bulk_threshold => 1000
REMOTE SOURCES:
http://gems.rubyforge.org/
Should I change to other gem versions? Thanks for your help
Below is the text in the console window when I debug while using rspec. In case it helps.
C:\ruby\bin\ruby.exe -e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift) C:\ruby\bin/rdebug-ide --port 3601 -- C:\ruby\bin/spec "C:/Documents and Settings/HP_Administrator/RubymineProjects/test2/test_spec.rb" --require teamcity/spec/runner/formatter/teamcity/formatter --format Spec::Runner::Formatter::TeamcityFormatter:matrix
Testing started at 8:53 AM ...
Fast Debugger (ruby-debug-ide 0.4.9) listens on :3601
got testing 123
testin
got testtest
testte
got testtest
2 examples, 0 failures, 2 passed
Finished in 0.094 seconds
C:/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.9/bin/spec:5:in `exit'
C:/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.9/bin/spec:5
C:\ruby\bin/spec:19:in `load'
C:\ruby\bin/spec:19
C:/ruby/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.9/lib/ruby-debug-ide.rb:109:in `debug_load'
C:/ruby/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.9/lib/ruby-debug-ide.rb:109:in `debug_program'
C:/ruby/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.9/bin/rdebug-ide:87
C:\ruby\bin/rdebug-ide:19:in `load'
C:\ruby\bin/rdebug-ide:19
-e:1:in `load'
-e:1
Uncaught exception: exit
Process finished with exit code 1
I have no idea.. I'm using the same debug gems but for Mac
I am having the same problem with the latest RubyMine on Ubuntu (32bit).
Ruby 1.8.7
ruby-debug-id 0.4.9
All the gems are at their latest stable versions.
Gleb, it is another problem. According your console output
1. your test wasn't launched in "debug mode"
2. it seems due to
your test framework wasn't initialized properly. If you launch this test from console you will get the same error. Most likely your forgot to apply migrations to your "test" db.
The migrations should have run automatically (we do `rake db:test:import_from_dev` in our spec_helper).
However, I fixed the problem by uninstalling ruby-debug*, and then installing ruby-debug-id
http://rubyforge.org/tracker/index.php?func=detail&aid=27055&group_id=3085&atid=11903
Thanks for this link:
http://rubyforge.org/tracker/index.php?func=detail&aid=27055&group_id=3085&atid=11903
This fixed the problem for me. (Ubuntu Jaunty)
Using Rspec/Cucumber with the debugger is sweet...