Alpha Curriculum - Mastermind Specs

I ran into a few problems that added a lot of difficulty:

  1. Code::parse
    It was possible to pass a string into instead of an array and still pass the spec. When I finally got to Code#, this led to a lot of confusion.

  2. Game#get_guess
    I needed $stdin to use my gets method. The solution didn’t seem to require it, and the problem seemed to be with my computer instead of the specs. Perhaps note for others who might run into the same issue?

  3. Game::display_matches
    The answered required me to print strings that had either “exact” or “near” at least once, which meant that using “Exact” and “Near” did not work. For an exercise that is meant to practice using objects, this extra requirement seemed a bit out of place. To be fair, the spec expect($stdout.string).to match(/exact/) was there, but due to the very brief discussion of #stdout / $stdin and /exact/ in the I/O curriculum, and the very few exercises that practiced them, it was ver difficult to understand what was wanted of me.


Found something interesting:

Running bundle exec rspec –color requires $stdin to pass
Running bundle exec rspec without –color passes without the need for $stdin

1 Like