Can't debug practice 1 with pry/byebug

I cant seem to load any of the files (RSPEC practice 1) into pry. As I work through them, although they are simple enough to not really need the debugger, I would like to be able to step through certain methods via the terminal… I open pry from the current working directory (Ive also tried it from the home directory) and try to load the file and I get the error:

cannot load such file – file name
from: (pry):1:in `load’

I had no problem using the debugger when we were working with the primes.rb file in the pry tutorial, are we supposed to access the forked files in a different way? Any help would be greatly appreciated! Thanks!

Going to need more information. Try pasting more of what you are doing in the terminal.

Also, incase you don’t already, know that the “working” directory for loading in pry should be where the file is located. So you should be in …rspec1/lib/ to load the file.

Hi Zuhair, the directory that I am using is the name that I copied and pasted from the fork. The same thing I did when doing the first forked exercise (Hello_world).

Here are the last few lines from the terminal.
~/3b6a1428-brittanyzellman-rspec-1 (master)$ pry
[1] pry(main)> load ‘03_simon_says_spec.rb’
LoadError: cannot load such file – 03_simon_says_spec.rb
from: (pry):1:in `load’
[2] pry(main)>

“cd spec/” and then try again.

Hi Zuhair, you were right, I wasn’t in the lib. pry now is working (partially at least). Do i only need to be in the library when debugging, or should I have been there the whole time?

I said partially because when it isn’t stopping at the breakpoint, its just giving me the return value.

[6] pry(main)> titleize(“not stopping at breakpoint”)
=> “Not Stopping at Breakpoint”
[7] pry(main)>

I’ve added the require statement to the top of the class and ‘debugger’ at the first line of the method titleize.

Got it Zuhair!! My require statement had single quotes instead of double.

Thanks for your help!!!

1 Like