Compare commits

...

10 Commits

15 changed files with 115 additions and 43 deletions

View File

@ -1 +1 @@
2.6.0
2.7.0

View File

@ -1,5 +1,5 @@
source 'https://rubygems.org'
ruby '2.6.0'
ruby '2.7.0'
gem 'rails', '5.2.2'
# TODO Upgrade sprockets
gem 'sprockets', '~> 3.7'

View File

@ -1,5 +1,5 @@
GIT
remote: git://github.com/koenpunt/capistrano-nginx.git
remote: https://github.com/koenpunt/capistrano-nginx.git
revision: 5a91aed41c16fb38b6d9d9462ba1ddfe76dede55
specs:
capistrano-nginx (0.2.1)
@ -485,7 +485,7 @@ DEPENDENCIES
webdrivers
RUBY VERSION
ruby 2.6.0p0
ruby 2.7.0p0
BUNDLED WITH
1.17.3
2.1.2

View File

@ -1,6 +1,17 @@
Thirteen Tien Len
================
Development Environment Setup
-----------------------------
bundle install
cp config/{database.yml.example,database.yml}
rake db:setup
guard
TODO
----

View File

@ -13,9 +13,10 @@
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require react
//= require react_ujs
//= require components
// require react
// require react_ujs
// require components
//= require qrcode.min.js
// require react-rails-hot-loader
// require_tree .

View File

@ -0,0 +1,23 @@
#table-component, #table-component-container, .table
width: 100%
height: 100%
#table-controls
text-align: right
padding: 0 1em
#newgame
float: left
#qrcode
float: right
margin-top: -.5em
margin-right: 1em
transform: scale(10%)
transition: all 0.5s ease-in-out
width: 38px
height: 38px
&.full
margin-right: 2em
transform: scale(100%)
width: 384px
height: 384px

View File

@ -1,10 +0,0 @@
// Place all the styles related to the Tables controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
#table-component,
#table-component-container,
.table {
width: 100%;
height: 100%;
}

View File

@ -6,10 +6,12 @@
-# = button_to remove_bot_seat_path(seat) do
- "- Bot"
- if seat.occupied_by? current_user
= button_to stand_seat_path(seat), :data => { :confirm => 'Are you sure you want to leave this seat?' } do
-# = button_to stand_seat_path(seat), :data => { :confirm => 'Are you sure you want to leave this seat?' } do
= button_to stand_seat_path(seat) do
- "Leave"
- else
= button_to empty_seat_path(seat), :data => { :confirm => 'Are you sure you want to empty this seat?' } do
-# = button_to empty_seat_path(seat), :data => { :confirm => 'Are you sure you want to empty this seat?' } do
= button_to empty_seat_path(seat) do
- "Empty"
- else
= button_to sit_seat_path(seat) do
@ -18,7 +20,8 @@
- "+ Bot"
- if seat.player
= button_to remove_player_seat_path(seat), :data => { :confirm => 'Are you sure you want to remove this player?' } do
-# = button_to remove_player_seat_path(seat), :data => { :confirm => 'Are you sure you want to remove this player?' } do
= button_to remove_player_seat_path(seat) do
- "Remove Player"
.player{id: "player-#{seat.player.id}", class: @game.controlling_player == seat.player ? "taking-turn" : "",
data: {soft_token: seat.player.soft_token} }

View File

@ -16,7 +16,26 @@
-# = button_to 'New Game', new_game_table_path(@table)
-# - if @game && !@game.startable?
= button_to 'New Game', new_game_table_path(@table)
#table-controls
#newgame= button_to 'New Game', new_game_table_path(@table)
#qrcode
:javascript
function gen_qrcode(){
var qrcode = new QRCode(document.getElementById("qrcode"), {
text: "#{request.original_url}",
width: 384,
height: 384,
colorDark : "#000000",
colorLight : "#ffffff00",
correctLevel : QRCode.CorrectLevel.H
});
}
gen_qrcode();
$('#qrcode').on('click', function(e) {
$('#qrcode').toggleClass("full");
e.preventDefault();
});
#game-component
- if @game.winner_player_id

View File

@ -1,16 +0,0 @@
#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'sass-convert' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
require 'rubygems'
require 'bundler/setup'
load Gem.bin_path('sass', 'sass-convert')

View File

@ -57,6 +57,19 @@ RSpec.feature "EndOfGames", type: :feature do
end
describe 'I lose the game' do
pending
# Another player plays their last card(s)
# Expect that they are the winner
end
describe 'I win 2nd place' do
pending
# Another player plays their last card(s)
# Expect that they are the winner
end
describe 'Play to beat clears appropriately' do
pending
# Another player plays their last card(s)
# Expect that they are the winner
end

View File

@ -16,7 +16,7 @@ feature 'Play now', :devise do
end
it 'creates and joins a new game' do
#TODO: Fix race condition
sleep 2
# sleep 2
expect(page).to have_content "Hand to beat"
#Game title derived from visitor soft_token
expect(page).to have_content "#{Game.last.players.first.soft_token[0..4]}"
@ -39,7 +39,7 @@ feature 'Play now', :devise do
#expect(page).to have_content "Test Game"
# expect(page).to have_content "Hand to beat"
# TODO fix race condition
sleep 8
# sleep 8
#it 'is located at the correct url' do
expect(page).to have_current_path(table_path(@table))
expect(page).to have_content "Guest"

View File

@ -38,7 +38,7 @@ feature 'Seats', :devise do
expect(page.find(:css, ".seat.position-1 .player")).to have_content "Guest"
click_button 'Sit', match: :first
expect(page).to have_content "Guest"
expect(page.find(:css, ".seat.position-2 .player")).to have_content "Guest"
expect(page.find(:css, ".seat.position-4 .player")).to have_content "Guest"
end
#TODO: User can only occupy one seat per table
@ -48,7 +48,7 @@ feature 'Seats', :devise do
expect(page.find(:css, ".seat.position-1")).to have_content "Guest"
click_button 'Sit', match: :first
expect(page).to have_content "Guest"
expect(page.find(:css, ".seat.position-2")).to have_content "Guest"
expect(page.find(:css, ".seat.position-4")).to have_content "Guest"
expect(page.text.scan('Guest').count).to eq 1
end

View File

@ -1,5 +1,32 @@
require 'rails_helper'
RSpec.describe PlayToBeat, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
before(:each) do
@game = setup_game
@play_to_beat = @game.controlling_player.plays.new(game_id: @game.id)
end
subject { @play_to_beat }
it { should respond_to(:game_id) }
it { should respond_to(:game) }
it { should respond_to(:player_id) }
it { should respond_to(:player) }
it { should respond_to(:player_cards) }
it { should respond_to(:hand) }
it { should respond_to(:hand_type) }
it { should respond_to(:to_s) }
it '#game_id returns a game id' do
expect(@play_to_beat.game).to eq Game.find(@play_to_beat.game_id)
end
describe 'an unsuited run beaten by an suited run' do
it 'remains unsuited' do
# todo create unsuited run
# beat with suited run
expect(@play_to_beat.game).to eq Game.find(@play_to_beat.game_id)
end
end
end

File diff suppressed because one or more lines are too long