How do I ruby-debug in a spec or feature if I am using Guard and Spork?

1k views Asked by At

I managed to get Cucumber, RSpec, Guard, and Spork play nicely with each other in a Rails 3 app, but now I am stuck with the above problem.

Currently I require 'spork/ext/ruby-debug' in the prefork block of spec_helper.rb but this works only if I run spork manually, without guard.

2

There are 2 answers

1
zetetic On BEST ANSWER

This worked for me: Replace your 'guard-spork' gem with this one:

gem 'guard-spork', :git => 'https://github.com/irohiroki/guard-spork.git'

More info on this blog post (in Japanese, but Google translate does a decent job).

The author also created this handy Rails 3 example app to show how to set things up.

Adding Guard to Spork makes it much more useful IMO. I may have to go back to using it now :)

0
Brian Dear On

If you still have problems (or even if you don't,) I would recommend using the pry and pry-nav gems instead of Ruby debug.. they work flawlessly with guard/spork/rspec/cucumber and test unit.