I am having trouble or am confused with an rspec error when running:
rspec -fd game_spec
(the above is only the beginning of a long eror message)
When I run it without the -fd, it works... but it looks goofy... something is wrong. I start getting error messages when I use gets.chomp but I've looked at similar examples that use it. Does 'the_word' have to be set in initialize? Does gets.chomp or can it? I appreciate any help. Below is game file and its rspec so far. I do not want to change much at all. I just want to get what I have so far working and keep pushing on. Thanks!
The reason is that
gets
reads fromARGV
(argument variables), such as the-fd
flag you're giving torpsec
.You can recreate this situation pretty easily:
You can prevent this from happening by clearing out
ARGV
before callinggets.
You can't just say
ARGV = []
because it's a constant, but callingclear
is fine because it's not redefining the variable.In short, just put this somewhere before
gets.chomp
:Here's another question on the topic: Ruby readline fails if process started with arguments