好的,rspec noob 在这里...我有一个简单的方法,我想测试一下。我只是想让测试说......当这个方法被调用时,它返回一个符号......任何指针?
方法....
def defend_corners(board)
@board = board
@corners = {
:a1=>" ", :a3=>" ",
:c1=>" ", :c3=>" "
}
available_moves = @corners.select{ |k, v| v == " " }.keys
puts "random move - corners"
@move = available_moves[rand(available_moves.length)]
return @move
end
目前的测试......
describe 'defend_corners' do
it 'returns corner move' do
myboard = Board.new
@player_computer.defend_corners(myboard).should #return a symbol???
end
end