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
|
# Set status to first turn
|
||||||
# Player with the lowest card
|
# 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
|
self.controlling_player_id = self.lowest_card.player.id
|
||||||
save
|
save
|
||||||
end
|
end
|
||||||
|
|||||||
@ -6,11 +6,16 @@ class Player < ActiveRecord::Base
|
|||||||
has_many :player_cards
|
has_many :player_cards
|
||||||
has_many :plays
|
has_many :plays
|
||||||
|
|
||||||
#TODO: soft_user will not have a user_id
|
#TODO: Note: soft_user is not associated with a user
|
||||||
validates :user, presence: true
|
#validates :user, presence: true
|
||||||
validates :game, presence: true
|
validates :game, presence: true
|
||||||
|
|
||||||
def inventory
|
def inventory
|
||||||
player_cards.where(play_id: nil).order(:value)
|
player_cards.where(play_id: nil).order(:value)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def display_name
|
||||||
|
self.try(:user).try(:email) || "Guest#{self.soft_token[0..5]}"
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -22,6 +22,10 @@ feature 'Play now', :devise do
|
|||||||
#TODO: Remove race condition
|
#TODO: Remove race condition
|
||||||
visit current_path
|
visit current_path
|
||||||
click_button 'Start'
|
click_button 'Start'
|
||||||
|
#TODO: Remove race condition
|
||||||
|
visit current_path
|
||||||
|
visit current_path
|
||||||
|
visit current_path
|
||||||
visit current_path
|
visit current_path
|
||||||
expect(page).to have_content 'Inventory'
|
expect(page).to have_content 'Inventory'
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user