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
|
self.game.play_to_beat_id = nil
|
||||||
end
|
end
|
||||||
self.game.save
|
self.game.save
|
||||||
|
return "pass"
|
||||||
end
|
end
|
||||||
|
|
||||||
def runs
|
def runs
|
||||||
|
|||||||
@ -30,6 +30,10 @@ class SeatPolicy
|
|||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def stand?
|
||||||
|
true # TODO check that user is sitting here
|
||||||
|
end
|
||||||
|
|
||||||
def add_bot?
|
def add_bot?
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|||||||
@ -7,7 +7,7 @@ class TablePolicy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def index?
|
def index?
|
||||||
@current_user.admin?
|
@current_user.admin? || true
|
||||||
end
|
end
|
||||||
|
|
||||||
def show?
|
def show?
|
||||||
@ -24,7 +24,7 @@ class TablePolicy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def play_now?
|
def play_now?
|
||||||
@current_user.admin? || @current_user.email == "bort@13.24x7.hk"
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def new_game?
|
def new_game?
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<nav>
|
<nav>
|
||||||
<ul>
|
<ul>
|
||||||
<%# <li><%= link_to 'Main Menu', root_path %1></li> %>
|
<li><%= link_to 'Main Menu', root_path %></li>
|
||||||
<% if policy(:table).index? %>
|
<% if policy(:table).index? %>
|
||||||
<li><%= link_to 'Tables', tables_path %></li>
|
<li><%= link_to 'Tables', tables_path %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@ -22,9 +22,9 @@
|
|||||||
<%= yield %>
|
<%= yield %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer>
|
<%#<footer>%>
|
||||||
<%= render "layouts/footer" %>
|
<%#<%= render "layouts/footer" %>
|
||||||
</footer>
|
<%#</footer>%>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
#main-menu
|
#main-menu
|
||||||
- if policy(:table).play_now?
|
- if policy(:table).play_now?
|
||||||
= link_to 'Play', play_now_path
|
= link_to 'Play Now', play_now_path
|
||||||
- else
|
- else
|
||||||
Soon
|
Soon
|
||||||
-# = link_to 'Browse Tables', tables_path
|
= link_to 'Browse Tables', tables_path
|
||||||
-# = link_to 'Tutorial', tutorial_path
|
= link_to 'Tutorial', tutorial_path
|
||||||
-# = link_to 'About', page_path('about')
|
= link_to 'About', page_path('about')
|
||||||
|
|||||||
@ -14,8 +14,16 @@ feature 'Bot takes turn', type: :feature do
|
|||||||
expect(page).to have_content "BotPlayer"
|
expect(page).to have_content "BotPlayer"
|
||||||
@button = page.find_button('Sit', match: :first).click
|
@button = page.find_button('Sit', match: :first).click
|
||||||
click_button "Start"
|
click_button "Start"
|
||||||
click_button 'Pass'
|
# click_button 'Pass'
|
||||||
expect(page).to have_content "Bot is passes"
|
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
|
end
|
||||||
|
|
||||||
scenario 'bot player plays single' do
|
scenario 'bot player plays single' do
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user