-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For logged in users (still shadow shipped), when a game is finished they can chose to replay the same board from the start.
- Loading branch information
1 parent
fc0a9d4
commit 31111e0
Showing
7 changed files
with
125 additions
and
14 deletions.
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe "Games Controller" do | ||
fixtures :accounts | ||
|
||
let(:account) { accounts(:freddie) } | ||
let(:public_game) { Game.create!(board:) } | ||
let(:private_game) { Game.create!(board:, owner: account) } | ||
let(:board) do | ||
Board.create!( | ||
width: 10, | ||
height: 10, | ||
mines: [Mine.new(x: 2, y: 2)], | ||
) | ||
end | ||
|
||
describe "show" do | ||
it "doesn't allow viewing other's private game" do | ||
post "/#", params: { email: accounts(:brian).email, password: "password"} | ||
|
||
get "/games/#{private_game.id}" | ||
|
||
expect(response).to be_not_found | ||
end | ||
end | ||
|
||
describe '#replay' do | ||
it "doesn't allow replaying an unfinished game" do | ||
post "/#", params: { email: account.email, password: "password" } | ||
|
||
post "/games/#{public_game.id}/replay" | ||
|
||
expect(response).to be_forbidden | ||
end | ||
end | ||
end |
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