# mspwong/checkers_railsless

cleaned up tests

• Loading branch information...
1 parent 4f487f3 commit 3257c3263ecf72edb13885a042b39c4cc9a55358 committed Sep 1, 2011
Showing with 15 additions and 20 deletions.
1. +15 −20 spec/game_spec.rb
35 spec/game_spec.rb
 @@ -108,11 +108,10 @@ piece = {:team => :red, :piece_num => 4} position = @game.position(piece) x, y = position.first, position.last - @game.move(piece, [x-1, y-1]) - position = @game.position(piece) + expect { @game.move(piece, [x-1, y-1]) }.to change { position = @game.position(piece) } x, y = position.first, position.last - @game.move(piece, [x-1, y-1]) - @game.position(piece).should eq [6, 4] + expect { @game.move(piece, [x-1, y-1]) }.to change { position = @game.position(piece) } + position.should eq [6, 4] end end @@ -121,11 +120,10 @@ piece = {:team => :white, :piece_num => 12} position = @game.position(piece) x, y = position.first, position.last - @game.move(piece, [x-1, y+1]) - position = @game.position(piece) + expect { @game.move(piece, [x-1, y+1]) }.to change { position = @game.position(piece) } x, y = position.first, position.last - @game.move(piece, [x-1, y+1]) - @game.position(piece).should eq [5, 5] + expect { @game.move(piece, [x-1, y+1]) }.to change { position = @game.position(piece) } + position.should eq [5, 5] end end end @@ -148,8 +146,8 @@ @game.move(piece, [x-1, y-1]) position = @game.position(piece) x, y = position.first, position.last - @game.move(piece, [x+1, y-1]) - @game.position(piece).should eq [8, 4] + expect { @game.move(piece, [x+1, y-1]) }.to change { position = @game.position(piece) } + position.should eq [8, 4] piece = {:team => :white, :piece_num => 12} position = @game.position(piece) @@ -159,17 +157,16 @@ piece = {:team => :red, :piece_num => 8} position = @game.position(piece) x, y = position.first, position.last - @game.move(piece, [x+1, y-1]) - @game.position(piece).should eq [8, 6] + expect { @game.move(piece, [x+1, y-1]) }.to change { position = @game.position(piece) } + position.should eq [8, 6] piece = {:team => :white, :piece_num => 12} position = @game.position(piece) x, y = position.first, position.last - @game.move(piece, [x-1, y+1]) - position = @game.position(piece) + expect { @game.move(piece, [x-1, y+1]) }.to change { position = @game.position(piece) } x, y = position.first, position.last - @game.move(piece, [x-1, y+1]) - @game.position(piece).should eq [5, 5] + expect { @game.move(piece, [x-1, y+1]) }.to change { position = @game.position(piece) } + position.should eq [5, 5] piece = {:team => :red, :piece_num => 2} position = @game.position(piece) @@ -179,11 +176,9 @@ piece = {:team => :white, :piece_num => 8} position = @game.position(piece) x, y = position.first, position.last - @game.move(piece, [x-1, y+1]) - position = @game.position(piece) + expect { @game.move(piece, [x-1, y+1]) }.to change { position = @game.position(piece) } x, y = position.first, position.last - @game.move(piece, [x-1, y+1]) - position = @game.position(piece) + expect { @game.move(piece, [x-1, y+1]) }.to change { position = @game.position(piece) } x, y = position.first, position.last [x, y].should eq [6, 4] lambda { @game.move(piece, [x-1, y+1]) }.should raise_error ValidationError

#### 0 comments on commit `3257c32`

Please sign in to comment.