Adding feature visitor play now

This commit is contained in:
Jesse C. Fisher 2016-01-24 16:52:22 -08:00
parent 15a75bc462
commit 7af48a92a3
3 changed files with 12 additions and 3 deletions

View File

@ -32,7 +32,7 @@ class Game < ActiveRecord::Base
# Set status to first turn
# Player with the lowest card
self.status = 'First Play at: ' + self.lowest_card.player.user.email
self.status = 'First Play at: ' + self.lowest_card.player.display_name
self.controlling_player_id = self.lowest_card.player.id
save
end

View File

@ -6,11 +6,16 @@ class Player < ActiveRecord::Base
has_many :player_cards
has_many :plays
#TODO: soft_user will not have a user_id
validates :user, presence: true
#TODO: Note: soft_user is not associated with a user
#validates :user, presence: true
validates :game, presence: true
def inventory
player_cards.where(play_id: nil).order(:value)
end
def display_name
self.try(:user).try(:email) || "Guest#{self.soft_token[0..5]}"
end
end

View File

@ -22,6 +22,10 @@ feature 'Play now', :devise do
#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