Rails, Spork and debugger
Asked Answered
A

2

9

I use spork with Guard + Rspec but the debugger doesn't work as expected:

  • I added require 'spork/ext/ruby-debug' just after the require 'spork'

  • it properly stops on debugger breakpoints...

  • ... but I can't access irb, it spits: Command is available only in local mode.

Do you know how to get around this?

Thanks,


PS: of course I read this question but it's a bit outdated and doesn't work.

PS2: I'd like to avoid using this.

PS3: : I also posted this as an issue here.

Aquacade answered 16/11, 2011 at 8:34 Comment(0)
F
7

Consider using pry, it is so much more awesome. I include it in my spec_helper file (works with Test::Unit too) and can do binding.pry within my tests to essentially pry into objects. Works fine with Guard/Spork/RSpec/Cucumber/Spinach for me.

Pry has long since replaced IRB as my default REPL.

Fourdrinier answered 16/11, 2011 at 10:47 Comment(13)
Interesting. What do you exactly include and where please?Aquacade
Are you using RSpec or Test::Unit? There's a screencast on this as well. Pry with RailsFourdrinier
Rspec. +1 for your help so far.Aquacade
Take a look here for my config: github.com/bsodmike/CoreApp/blob/source/spec/spec_helper.rbFourdrinier
You can then just do binding.pry in any test and see 'magic' happen when you run the spec =) Watch the awesome casts on pry.Fourdrinier
Just wondering: did you keep config.cache_classes to true in your test.rb file (leading to spork restarts) or did you set it to false (which crashes capybara)?Aquacade
I don't recall touching that option. Some more info on config.cache_classesFourdrinier
Your solution doesn't work in my app, while reaching a binding.pry line, I see ugly lines with lib/pry/pry_instance.rb:414:in 'readline' TypeError: wrong argument type DRb::DRbObject (expected File). But it works in your app. I'll search again but thanks for your help :)Aquacade
Indeed, I realized that using ree and not 1.9.2 could be the problem.: even your app is failing in this case.Aquacade
@apneadiving, could you file an issue on github.com/pry/pry/issues with instructions on how to reproduce? thanks!Crenel
apneadiving as you realised I've only tested that 'test' app against 1.9.2; as per @banister this seems to be a ree/pry issue. I've not had any issues with pry from Rails 3.0.8 to 3.1.1Fourdrinier
@banister, done here: github.com/pry/pry/issues/345. Thanks for noticing :)Aquacade
The pry team are pretty awesome - you can find them in #pry on irc.freenode.net too =)Fourdrinier
F
1

OP's bug report leads here, which advises to turn off interactive mode by starting guard like so:

bundle exec guard -i

This worked for me.

Fari answered 12/12, 2012 at 22:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.