Help with Class Extension Debugging Exercises

Hi, I need some help for Class Extension Debugging Exercises, the rspec did’t work after I type “bundle exec rspec” in the terminal, all empty shown as below screenshot. Can someone help with this, thanks.
(Btw, it works with other exercises projects. )

Hi @cindyko226,

That looks like it’s running an empty loop on it’s first test.

Hi Matthew,
Thanks for your reply. I try to debug it so I can run the rspec, and I got the message shown( nameerror) in the screenshot, is something wrong with the method or there is different way to call it with block?

Sorry,
I meant to write “infinite loop” rather than “empty loop”. It looks like your loop never ends so the rest of the test never runs.

I hope this helps!

Hi Matthew,

Thanks for your reply.
For the second screenshot, I can not run the “my_secret(&blk)” in pry, I would like to know why does that happened? Also, I feel confused, if the test can not be run and returned some error messages, then how to debug it, since I do not know what is wrong.

Hope you could help with this.

An infinite loop will always look like a blank screen in the context of running rspecs. It means that the loop never ends so we never make it to the next line of code. To clarify, the test is running and we have entered the code file we’re testing. You can typically type Ctrl + C to exit the program.

In order to run your method in pry, you need to 1) call it on an array, and 2) pass it a block.

For example:

arr = [1,2,3,4,5]

arr.my_select { |int| int.odd? } 
# the above should result in [1,3,5]

Don’t forget that the code won’t work in pry if it still has that infinite loop in it! You can do it!

Hi Matthew,

Thanks for your reply. Now I understand how to fix this problem and finish the project. That’s a great help from you.

Best regards,
Cindy