Mastermind: spec failing during gets call

I have no idea what could be causing this. Any tips?

  1) Game input/output #get_guess should parse input and return Code object
     Failure/Error: expect(game.get_guess).to be_instance_of(Code)
     Errno::EISDIR:
       Is a directory @ io_fillbuf - fd:7 spec
     # ./lib/mastermind.rb:84:in `gets'
     # ./lib/mastermind.rb:84:in `gets'
     # ./lib/mastermind.rb:84:in `get_guess'
     # ./spec/mastermind_spec.rb:145:in `block (4 levels) in <top (required)>'

Can you post your code?

That an interesting error to be getting, it’s actually an error initially coming from your OS and not ruby itself. Somewhere in your get_guess method (or maybe your Code class?) you are trying to open a directory for writing, which you can not do, hence the error. Do you have File.open('something/') somewhere in your code? if so, I’m not sure why you would need that for your mastermind program.

https://ghostbin.com/paste/gz4q6

I don’t have any file I/O in my code.

So I just ran your code on my computer it passed all the specs… I’m not sure how to help if I can’t replicate the error and then play around with it.

Same as corey here, your code passes all the specs for me.

Perhaps it’s an error with your Rspec gem?

You can try bundle install again/verify that you are using the current version in your Gemfile.
the current version is 3.6.0, per rspec

@aarzee try calling $stdin.gets explicitly

2 Likes

I had the exact same error, $stdin.gets in the get_guess method let me pass all the specs finally. Thanks!

1 Like