Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--debug not working RSpec (2.0.0.beta.7) #24

Closed
spovich opened this issue Apr 21, 2010 · 12 comments
Closed

--debug not working RSpec (2.0.0.beta.7) #24

spovich opened this issue Apr 21, 2010 · 12 comments

Comments

@spovich
Copy link

spovich commented Apr 21, 2010

Running 'rake spec' with '--debug' in my .rspec file will produce:

"debugger statement ignored, use -d or --debug option on rspec to enable debugging"

Same thing when running 'rspec -d ./spec'

Running 'rdebug rspec ./spec' works ok.

Thanks!

@timcharper
Copy link
Contributor

This is a bug I ran into too. It's caused because Rsepc is actually putting it's debugger method in Object, instead of Kernel. (and Object instance methods take precedence over Kernel ones).

This patch resolves the issue for me:

http://github.com/timcharper/rspec-core/commit/c476e088ebabb4a89c8566be4fa07849d88271ac

@dchelimsky
Copy link
Contributor

@dchelimsky
Copy link
Contributor

Turns out that didn't really solve the problem, but this did: http://github.com/rspec/rspec-core/commit/99727ba70461ee921fbdff5b84e514a6dca83635

@timcharper
Copy link
Contributor

Weird.. the patch certainly solved the problem for me.

@dchelimsky
Copy link
Contributor

Tim - the experience I had was that when I had a debugger statement but did not include the -d flag, I got an undefined method error on debugger. This is because ruby-debug gets required after the kernel extensions do, so at the time the kernel extensions get loaded, the unless defined? test fails.

Make sense?

@timcharper
Copy link
Contributor

What you say makes sense, but why it didn't work doesn't.

I used the debugger w/out the -d flag. I have a textmate snippet that does "require 'ruby-debug'; debugger"... and it worked perfectly fine.

But, at any rate, I trust your sanity, and therefore your claim that it was still broken. Thank you very much for your work on RSpec!

@dchelimsky
Copy link
Contributor

I'm guessing the textmate snippet loaded ruby-debug before rspec loaded, so what you describe makes sense. Make sense?

@timcharper
Copy link
Contributor

Unlikely, I stuck it right in the middle of an example.

@dchelimsky
Copy link
Contributor

Not sure what's different in our environments but it works for me now as I expect and it didn't before. Can you do me a favor and pull the latest, build the gem and make sure it's working as you expect?

@timcharper
Copy link
Contributor

Works just great here! Thank you.

@dchelimsky
Copy link
Contributor

Great. Thanks Tim.

@mikesmullin
Copy link

also, if you are using bundler, make sure you have included the 'ruby-debugger19' under test env in your Gemfile, or it won't be included by rspec -d.

timcharper added a commit to timcharper/rspec-core that referenced this issue Aug 19, 2011
Closes rspec#24

Motivation: ruby-debug defines its debugger method inside of the kernel module, not as an instance method of Object. By making this change, it allows one to require "ruby-debug" after rspec is loaded, and have ruby-debug's Kernel#debugger method override rspec's stub method (whereas before rspec's stub method took precedence over ruby-debug's #debugger method if ruby-debug was loaded after rspec).
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants