Bot pass spec, policies, layout changes
This commit is contained in:
parent
8b74af11c6
commit
50508da8f8
@ -36,6 +36,7 @@ class Player < ActiveRecord::Base
|
||||
self.game.play_to_beat_id = nil
|
||||
end
|
||||
self.game.save
|
||||
return "pass"
|
||||
end
|
||||
|
||||
def runs
|
||||
|
||||
@ -30,6 +30,10 @@ class SeatPolicy
|
||||
true
|
||||
end
|
||||
|
||||
def stand?
|
||||
true # TODO check that user is sitting here
|
||||
end
|
||||
|
||||
def add_bot?
|
||||
true
|
||||
end
|
||||
|
||||
@ -7,7 +7,7 @@ class TablePolicy
|
||||
end
|
||||
|
||||
def index?
|
||||
@current_user.admin?
|
||||
@current_user.admin? || true
|
||||
end
|
||||
|
||||
def show?
|
||||
@ -24,7 +24,7 @@ class TablePolicy
|
||||
end
|
||||
|
||||
def play_now?
|
||||
@current_user.admin? || @current_user.email == "bort@13.24x7.hk"
|
||||
true
|
||||
end
|
||||
|
||||
def new_game?
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<nav>
|
||||
<ul>
|
||||
<%# <li><%= link_to 'Main Menu', root_path %1></li> %>
|
||||
<li><%= link_to 'Main Menu', root_path %></li>
|
||||
<% if policy(:table).index? %>
|
||||
<li><%= link_to 'Tables', tables_path %></li>
|
||||
<% end %>
|
||||
|
||||
@ -22,9 +22,9 @@
|
||||
<%= yield %>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<%= render "layouts/footer" %>
|
||||
</footer>
|
||||
<%#<footer>%>
|
||||
<%#<%= render "layouts/footer" %>
|
||||
<%#</footer>%>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -3,9 +3,9 @@
|
||||
|
||||
#main-menu
|
||||
- if policy(:table).play_now?
|
||||
= link_to 'Play', play_now_path
|
||||
= link_to 'Play Now', play_now_path
|
||||
- else
|
||||
Soon
|
||||
-# = link_to 'Browse Tables', tables_path
|
||||
-# = link_to 'Tutorial', tutorial_path
|
||||
-# = link_to 'About', page_path('about')
|
||||
= link_to 'Browse Tables', tables_path
|
||||
= link_to 'Tutorial', tutorial_path
|
||||
= link_to 'About', page_path('about')
|
||||
|
||||
@ -14,8 +14,16 @@ feature 'Bot takes turn', type: :feature do
|
||||
expect(page).to have_content "BotPlayer"
|
||||
@button = page.find_button('Sit', match: :first).click
|
||||
click_button "Start"
|
||||
click_button 'Pass'
|
||||
expect(page).to have_content "Bot is passes"
|
||||
# click_button 'Pass'
|
||||
bot_player = @game.players.first
|
||||
# set bot inventory value low so has to pass
|
||||
# kind of hacky
|
||||
bot_player.inventory.map{|i| i.value = 2; i.save}
|
||||
@game = @table.current_game
|
||||
@card_to_play = @game.controlling_player.inventory.first
|
||||
find("[data-card-name='#{@card_to_play.to_s}']").click
|
||||
click_button 'Play Hand'
|
||||
expect(page).to have_content "#{bot_player.display_name} passed."
|
||||
end
|
||||
|
||||
scenario 'bot player plays single' do
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user