1

We are trying to use pry-rescue inside of rspec to get a debugger when a spec fails.

Now when this expectation fails:

 expect(page).to have_content('Thanks for signing up!')

pry does open, but the code point that pry is at looks like this:

From: /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/pry-rescue-1.4.4/lib/pry-rescue.rb @ line 206 PryRescue.with_program_name:

   201: def with_program_name name
   202:   before = $PROGRAM_NAME
   203:   $PROGRAM_NAME = name
   204:   yield
   205: ensure
=> 206:   $PROGRAM_NAME = before
   207: end

which is obviously not the code of the failing spec. From here on we can only go "up".

We expected to end right at the failing spec (as e.g. pointed out here: Start ruby debugger if rspec test fails).

Why does the above happen instead what did we do wrong?

We are using rspec 3.4.0, pry 0.10.3 and pry-rescue 1.4.4.

Community
  • 1
  • 1
Alexander Presber
  • 6,429
  • 2
  • 37
  • 66
  • The same is happening to me currently. And on a regular pry rescue flow: rescue rails server. – parreirat Jan 26 '17 at 09:40
  • 1
    Found out, pry-byebug is causing the issue when used along with pry-rescue. And here's a 2-3 year old issue with it: https://github.com/ConradIrwin/pry-rescue/issues/71 – parreirat Jan 26 '17 at 10:11

0 Answers0