App Academy

Mastermind ask_user_for_guess method failing

I was passing all the specs except for this one. Then I realized that my num_near_matches method was wrong even though it was passing the specs. Everything started working fine after I corrected my num_near_matches method. Read this post to learn more about the error.

Add the following rspec code to the num_near_matches method and try to pass the test.

    it "should not count a matched peg with a correct colored peg in a different position" do
        expect(code.num_near_matches(Code.new(["G", "G", "R", "B"]))).to eq(0)
    end

Hope this helps

Hi, can you please share your correct num_near_matches method? I’m stuck on it and the solution in the video hasn’t been updated. Thanks.