33 lines
982 B
Ruby
33 lines
982 B
Ruby
# Feature: Play now
|
|
# As a visitor
|
|
# I want to quickly join a game
|
|
# So I can play
|
|
feature 'Play now', :devise do
|
|
before { @game = FactoryGirl.create :game }
|
|
# Scenario: Visitor can play now
|
|
# Given I am not signed in
|
|
# When I click Play Now
|
|
# Then I join a game
|
|
scenario 'visitor can join a game', js: true do
|
|
visit root_path
|
|
click_link 'Play Now'
|
|
expect(page).to have_content "Test Game"
|
|
expect(current_path).to eq game_path(@game)
|
|
@player = @game.players.last
|
|
@playerComponent = page.find("#player-1")
|
|
expect(@playerComponent.text).to have_content("Guest#{@player.soft_token[0..5]}")
|
|
|
|
# Add another player
|
|
@game.add_player_from_user FactoryGirl.create :user
|
|
#TODO: Remove race condition
|
|
visit current_path
|
|
click_button 'Start'
|
|
#TODO: Remove race condition
|
|
visit current_path
|
|
visit current_path
|
|
visit current_path
|
|
visit current_path
|
|
expect(page).to have_content 'Inventory'
|
|
end
|
|
end
|