Created
May 12, 2017 00:25
-
-
Save apolishch/78558a1f9e6653d2cbdaa7bd7f7349d3 to your computer and use it in GitHub Desktop.
test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it "validates correct player's turn" do | |
mygame = FactoryGirl.create(:game) | |
anna = FactoryGirl.create(:user) | |
opponent = FactoryGirl.create(:user) | |
mygame.white_player_id = anna.id | |
mygame.black_player_id = opponent.id | |
mygame.save! | |
pawn = FactoryGirl.create(:pawn, game: mygame, user: anna) | |
sign_in anna | |
# pawn = create(:pawn, game: game, user_id: game.white_player_id) | |
# pawn.move(1, 3) | |
expect(mygame.turn).to eql anna.id | |
put :update, params: { id: pawn.id, piece: { user_id: white_player.id, game_id: game.id, x_position: 1, y_position: 3 } } | |
expect(response).to have_http_status(:unauthorized) | |
expect(response.body).to eql "It is your turn" | |
expect(mygame.turn).to eql opponent.id | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment