24 lines
760 B
Ruby
24 lines
760 B
Ruby
# Feature: Join Game
|
|
# As a visitor
|
|
# I want to join a game
|
|
# So I can play
|
|
feature 'Join game', :devise do
|
|
# Scenario: Visitor can join a game
|
|
# Given I am not signed in
|
|
# When I visit a joinable game
|
|
# Then I see a join button
|
|
scenario 'visitor can join a game', js: true do
|
|
visit new_game_path
|
|
fill_in 'game_title', with: 'Test Game'
|
|
click_button 'Create Game'
|
|
expect(page).to have_button("Join")
|
|
click_button 'Join'
|
|
#TODO: Fix this asynchronous race condition
|
|
visit current_path
|
|
@game = Game.find(current_path.split('/').last)
|
|
@player = @game.players.last
|
|
@playerComponent = page.find("#player-1")
|
|
expect(@playerComponent.text).to have_content("Guest#{@player.soft_token[0..5]}")
|
|
end
|
|
end
|