Add soft_token to game show

This commit is contained in:
Jesse C. Fisher 2016-01-23 19:41:11 -08:00
parent 149f55f489
commit b655e90a43
3 changed files with 25 additions and 1 deletions

View File

@ -7,7 +7,7 @@ var Player = React.createClass({
render: function() {
return (
<div id={"player-" + this.props.id} className={"player " + (this.props.game.controlling_player_id == this.props.id ? 'has-control' : '')}>
<div className='email'>{this.props.email}</div>
<div className='user-name'>{this.props.email || "Guest" + this.props.soft_token.substr(0,6)}</div>
{this.props.game.is_started
?
<div>Inventory count: {this.props.inventory_count}</div>

View File

@ -17,6 +17,7 @@ json.players @game.players do |player|
json.email player.user.try(:email)
json.inventory_count player.inventory.count
json.user_id player.user.try(:id)
json.soft_token player.soft_token
if player.user == current_user
json.inventory player.inventory

View File

@ -0,0 +1,23 @@
# 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