Mastermind - #get_guess error

Hi, I am working on the Mastermind problem, and have been able to build fully functional code using the skeleton outlined in the instructions. I have tested out the code and found it to function as I would expect, however I get the following error message for the #get_guess spec:

Any idea why this is happening? Based on my google searches, it sounds like the spec might be trying to access some file that doesn’t exist? I re-downloaded the project as I thought I might have erroneously deleted something in the spec file when I initially worked on it, but when I copy and pasted my code into the newly downloaded file, I got the same error. Probably going to submit the code anyway since I can see that it functions properly, but would like to understand what is causing this error, and how it can be fixed.

Thanks in advance for your help!

Is your get_guess method creating a new Code object?

It should be calling Code::parse each time a guess is given.

Not sure if thats the issue, hard to tell without seeing some of your code.

Hey, thanks for the reply - this actually came up in the discussion chat and the tests pass fine if I drop the ‘–color’ tag when i run the RSPEC tests. My code is using Code::parse on the user input. Seems like it’s just something weird about the --color tag that confuses the test.


had the same issue, came here, took the advice of removing --color. Would be nice to know why that happened though.

I got this too. I had to call $stdin.gets instead of just gets. I don’t know why this happens, though.

I believe it happens because it’s reading the arguments after the RSPEC directory/file/line arguments as standard input. It only seems to happen when the RSPEC file has $stdin in it, like on line:139 of mastermind_spec.rb.