Adding feature visitor play now
This commit is contained in:
parent
15a75bc462
commit
7af48a92a3
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user