Ok, need help working out a test. I want to test that this class receives a letter "O" and that when called the "move_computer" method returns WHATEVER the person enters on the cli. my mental subprocessor tells me this is a simple assign a variable to something to hold the random human input at STDIN. Just not getting it right now...anyone point me in the right direction?
here is my class...
class Player
def move_computer(leter)
puts "computer move"
@move = gets.chomp
return @move
end
end
my test look like...
describe "tic tac toe game" do
context "the player class" do
it "must have a computer player O" do
player = Player.new()
player.stub!(:gets) {"\n"} #FIXME - what should this be?
STDOUT.should_receive(:puts).with("computer move")
STDOUT.should_receive(:puts).with("\n") #FIXME - what should this be?
player.move_computer("O")
end
end
end