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
9 comments
Comment actions Permalink

I should have mentioned that this is on an XP system running 2.0 beta 2.

Thanks

0
Comment actions Permalink

In my case it works on MacOS

Screen shot 2009-10-28 at 19.47.47.png

the breakpoints don't work and I get either a segmentation fault or an error code when the program terminates.

It means that you've faced with ruby-debug gem bug. Which versions of ruby-debug-base, ruby-debug-ide do you use?

0
Comment actions Permalink

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

0
Comment actions Permalink

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

0
Comment actions Permalink

I have no idea.. I'm using the same debug gems but for Mac

0
Comment actions Permalink

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.

/usr/local/bin/ruby -e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift) /home/gleb/projects/justlanded/script/spec /home/gleb/projects/justlanded/spec/lib/i18n/active_record_associations_spec.rb --require teamcity/spec/runner/formatter/teamcity/formatter --format Spec::Runner::Formatter::TeamcityFormatter:matrix
Testing started at 5:55 PM ...
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract_adapter.rb:219:in `log': Mysql::Error: Table 'classifieds_gleb_test.locations' doesn't exist: SHOW FIELDS FROM `locations` (ActiveRecord::StatementInvalid)
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:323:in `execute'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:469:in `columns'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:1271:in `columns'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:1279:in `columns_hash'
    from /usr/lib/ruby/gems/1.8/gems/ar-extensions-0.9.2/lib/ar-extensions/extensions.rb:216:in `process_without_suffix'
    from /usr/lib/ruby/gems/1.8/gems/ar-extensions-0.9.2/lib/ar-extensions/extensions.rb:212:in `process'
    from /usr/lib/ruby/gems/1.8/gems/ar-extensions-0.9.2/lib/ar-extensions/extensions.rb:144:in `process'
    from /usr/lib/ruby/gems/1.8/gems/ar-extensions-0.9.2/lib/ar-extensions/extensions.rb:140:in `each'
    from /usr/lib/ruby/gems/1.8/gems/ar-extensions-0.9.2/lib/ar-extensions/extensions.rb:140:in `process'
    from /usr/lib/ruby/gems/1.8/gems/ar-extensions-0.9.2/lib/ar-extensions/finders.rb:63:in `sanitize_sql_from_hash'
    from /usr/lib/ruby/gems/1.8/gems/ar-extensions-0.9.2/lib/ar-extensions/finders.rb:55:in `each_pair'
    from /usr/lib/ruby/gems/1.8/gems/ar-extensions-0.9.2/lib/ar-extensions/finders.rb:55:in `sanitize_sql_from_hash'
    from /usr/lib/ruby/gems/1.8/gems/ar-extensions-0.9.2/lib/ar-extensions/finders.rb:27:in `sanitize_sql'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations.rb:1416:in `configure_dependency_for_has_many'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations.rb:824:in `has_many'
    from (eval):3:in `has_many'
    from /home/gleb/projects/justlanded/vendor/plugins/justlanded_core/lib/i18n/extra_model_translation.rb:21:in `translates_externally'
    from /home/gleb/projects/justlanded/vendor/plugins/justlanded_core/lib/i18n/extra_model_translation.rb:17:in `class_eval'
    from /home/gleb/projects/justlanded/vendor/plugins/justlanded_core/lib/i18n/extra_model_translation.rb:17:in `translates_externally'
    from /home/gleb/projects/justlanded/app/models/location.rb:15
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:in `require'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:265:in `require_or_load'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:425:in `load_missing_constant'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing_not_from_s3_library'
    from /home/gleb/.gem/ruby/1.8/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:in `const_missing'
    from /home/gleb/projects/justlanded/config/initializers/z_cache.rb:19
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:182:in `call'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:182:in `evaluate_method'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:166:in `call'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `run'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `each'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `send'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `run'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:276:in `run_callbacks'
    from /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:51:in `send'
    from /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:51:in `run_prepare_callbacks'
    from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:631:in `prepare_dispatcher'
    from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:185:in `process'
    from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'
    from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
    from /home/gleb/projects/justlanded/config/environment.rb:19
    from /home/gleb/projects/justlanded/script/spec:7:in `require'
    from /home/gleb/projects/justlanded/script/spec:7
    from -e:1:in `load'
    from -e:1
Empty test suite.


Process finished with exit code 1

0
Comment actions Permalink

I am having the same problem with the latest RubyMine on Ubuntu (32bit).

Gleb, it is another problem. According your console output
1. your test wasn't launched in "debug mode"
2. it seems due to

/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract_adapter.rb:219:in `log': Mysql::Error: Table 'classifieds_gleb_test.locations' doesn't exist: SHOW FIELDS FROM `locations` (ActiveRecord::StatementInvalid)


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.
0
Comment actions Permalink

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

0
Comment actions Permalink

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...

0

Please sign in to leave a comment.