I’m having problems getting some binding.pry calls to work when running cucumber tests: some work, some don’t.
If I call binding.pry directory from a step, as in:
When(/^I pry$/) do
binding.pry
end
That works just fine and I’m put into Pry interactive mode as expected.
If I call a routine which has a binding.pry down in the bowels of my code from a step:
When(/^I test my call$/) do
Clients::APD::MyService::V1::MyService.enroll('xyz')
end
That also works fine. I’m dropped into Pry at the expected point inside the enroll method.
However, if I have dropped into Pry as in the first case and then type:
Clients::APD::MyService::V1::MyService.enroll('xyz')
the binding.pry inside the enroll method is silently ignored.
What the heck am I missing here? Older versiona (we were on JRuby 1.9.3 until very recently; we are now on Ruby 2.0.0) worked just fine. I had to upgrade from pry-nav to pry-byebug for the 2.0 upgrade.
I’ve searched high and low for pointers about this issue. The only thing I am guessing is that some module is capturing STDIN and/or STDOUT and causing this problem?
Any pointers for finding a solution would be greatly appreciated!
Thanks…jon
UPDATE
Naturally, as soon as I poted this, I found what was happeneing: pry-byebug doesn’t support sub-debuggers or nested debugging. Invoking a method while in a pry session is a sub-debugger and is not supported <sigh>
. A common workflow of mine when figuring out how things work is to start a pry session, sprinkle a few binding.pry statements, and then call the methods I’m researching.
If anyone else is interested in this, I’ve added on to an existing issue: nesting does not work · Issue #71 · deivid-rodriguez/pry-byebug · GitHub. Additional comments requesting the ability to nest debugger calls would help move this forward.