summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomer Kimia <tkimia@purdue.edu>2014-03-27 16:59:11 -0400
committerTomer Kimia <tkimia@purdue.edu>2014-03-27 16:59:11 -0400
commita683a208e31d5bafe7658521921f9f2c1a637418 (patch)
treeabf23ef14f584583973796b3da573c5061eb8533
parentaeda550c2ad04c9496a803b1d7f1d34a4566a9fe (diff)
parentd8acc6785ee41a2628cd0d59d91916b2f087290b (diff)
Merge branch 'master' of https://github.com/LukeShu/leaguer
Conflicts: app/views/tournaments/show.html.erb
-rw-r--r--app/controllers/matches_controller.rb2
-rw-r--r--app/controllers/tournaments_controller.rb4
-rw-r--r--app/models/game_option.rb2
-rw-r--r--app/models/game_setting.rb3
-rw-r--r--app/views/matches/_form.html.erb4
-rw-r--r--app/views/matches/index.html.erb3
-rw-r--r--app/views/matches/index.json.jbuilder2
-rw-r--r--app/views/matches/show.html.erb5
-rw-r--r--app/views/matches/show.json.jbuilder2
-rw-r--r--app/views/tournaments/_form.html.erb4
-rw-r--r--app/views/tournaments/index.html.erb3
-rw-r--r--app/views/tournaments/index.json.jbuilder2
-rw-r--r--app/views/tournaments/show.html.erb24
-rw-r--r--app/views/tournaments/show.json.jbuilder2
-rw-r--r--db/migrate/20140307052409_create_game_options.rb11
-rw-r--r--db/migrate/20140325214513_create_servers.rb (renamed from db/migrate/20140307052327_create_servers.rb)0
-rw-r--r--db/migrate/20140325214516_create_matches.rb (renamed from db/migrate/20140307052331_create_matches.rb)1
-rw-r--r--db/migrate/20140325214518_create_teams.rb (renamed from db/migrate/20140307052334_create_teams.rb)0
-rw-r--r--db/migrate/20140325214521_create_alerts.rb (renamed from db/migrate/20140307052338_create_alerts.rb)0
-rw-r--r--db/migrate/20140325214523_create_pms.rb (renamed from db/migrate/20140307052342_create_pms.rb)0
-rw-r--r--db/migrate/20140325214525_create_tournaments.rb (renamed from db/migrate/20140307052346_create_tournaments.rb)1
-rw-r--r--db/migrate/20140325214528_create_games.rb (renamed from db/migrate/20140307052350_create_games.rb)0
-rw-r--r--db/migrate/20140325214531_create_users.rb (renamed from db/migrate/20140307052354_create_users.rb)0
-rw-r--r--db/migrate/20140325214533_create_sessions.rb (renamed from db/migrate/20140307052358_create_sessions.rb)0
-rw-r--r--db/migrate/20140325214536_create_server_settings.rb (renamed from db/migrate/20140307052402_create_server_settings.rb)0
-rw-r--r--db/migrate/20140325214538_create_tournament_options.rb (renamed from db/migrate/20140307052405_create_tournament_options.rb)0
-rw-r--r--db/migrate/20140325214540_create_game_settings.rb15
-rw-r--r--db/migrate/20140325214543_create_scores.rb (renamed from db/migrate/20140307052413_create_scores.rb)0
-rw-r--r--db/migrate/20140325214545_create_tournament_players_join_table.rb (renamed from db/migrate/20140307052417_create_tournament_players_join_table.rb)0
-rw-r--r--db/migrate/20140325214548_create_tournament_hosts_join_table.rb (renamed from db/migrate/20140307052421_create_tournament_hosts_join_table.rb)0
-rw-r--r--db/migrate/20140325214550_create_team_user_join_table.rb (renamed from db/migrate/20140307052424_create_team_user_join_table.rb)0
-rw-r--r--db/migrate/20140325214553_create_match_team_join_table.rb (renamed from db/migrate/20140307052428_create_match_team_join_table.rb)0
-rw-r--r--db/migrate/20140325214602_add_hidden_attrs_to_user.rb (renamed from db/migrate/20140307052443_add_hidden_attrs_to_user.rb)0
-rw-r--r--db/schema.rb14
-rwxr-xr-xgenerate.sh6
-rw-r--r--test/controllers/matches_controller_test.rb4
-rw-r--r--test/controllers/tournaments_controller_test.rb4
-rw-r--r--test/fixtures/game_settings.yml (renamed from test/fixtures/game_options.yml)12
-rw-r--r--test/fixtures/matches.yml2
-rw-r--r--test/fixtures/tournaments.yml2
-rw-r--r--test/models/game_setting_test.rb (renamed from test/models/game_option_test.rb)2
41 files changed, 95 insertions, 41 deletions
diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb
index 1f0d964..b312e9e 100644
--- a/app/controllers/matches_controller.rb
+++ b/app/controllers/matches_controller.rb
@@ -72,6 +72,6 @@ class MatchesController < ApplicationController
end
# Never trust parameters from the scary internet, only allow the white list through.
def match_params
- params.require(:match).permit(:tournament_id, :name, :winner_id)
+ params.require(:match).permit(:status, :tournament_id, :name, :winner_id)
end
end
diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb
index 7352e8d..8d90758 100644
--- a/app/controllers/tournaments_controller.rb
+++ b/app/controllers/tournaments_controller.rb
@@ -124,6 +124,8 @@ class TournamentsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def tournament_params
- params.require(:tournament).permit(:game, :game_id, :status, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams)
+
+ params.require(:tournament).permit(:game, :name, :game_id, :status, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams)
+
end
end
diff --git a/app/models/game_option.rb b/app/models/game_option.rb
deleted file mode 100644
index bdc5560..0000000
--- a/app/models/game_option.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-class GameOption < ActiveRecord::Base
-end
diff --git a/app/models/game_setting.rb b/app/models/game_setting.rb
new file mode 100644
index 0000000..e147b15
--- /dev/null
+++ b/app/models/game_setting.rb
@@ -0,0 +1,3 @@
+class GameSetting < ActiveRecord::Base
+ belongs_to :game
+end
diff --git a/app/views/matches/_form.html.erb b/app/views/matches/_form.html.erb
index 015aed0..3efb566 100644
--- a/app/views/matches/_form.html.erb
+++ b/app/views/matches/_form.html.erb
@@ -1,6 +1,10 @@
<%= form_for([@tournament, @tournament.matches.build]) do |f| %>
<div class="field">
+ <%= f.label :status %><br>
+ <%= f.number_field :status %>
+ </div>
+ <div class="field">
<%= f.label :tournament_id %><br>
<%= f.text_field :tournament_id %>
</div>
diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb
index 60df1b5..d862d57 100644
--- a/app/views/matches/index.html.erb
+++ b/app/views/matches/index.html.erb
@@ -3,6 +3,7 @@
<table>
<thead>
<tr>
+ <th>Status</th>
<th>Tournament</th>
<th>Name</th>
<th>Winner</th>
@@ -16,6 +17,8 @@
<% @tournament.matches.each do |match| %>
<tr>
<td><%= match.tournament.id %></td>
+ <td><%= match.status %></td>
+ <td><%= match.tournament %></td>
<td><%= match.name %></td>
<td><%= match.winner %></td>
<td><%= link_to 'Show', tournament_match_path(@tournament, match) %></td>
diff --git a/app/views/matches/index.json.jbuilder b/app/views/matches/index.json.jbuilder
index 0b2bfcd..1a63f5f 100644
--- a/app/views/matches/index.json.jbuilder
+++ b/app/views/matches/index.json.jbuilder
@@ -1,4 +1,4 @@
json.array!(@matches) do |match|
- json.extract! match, :id, :tournament_id, :name, :winner_id
+ json.extract! match, :id, :status, :tournament_id, :name, :winner_id
json.url match_url(match, format: :json)
end
diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb
index b6930ea..6b962ad 100644
--- a/app/views/matches/show.html.erb
+++ b/app/views/matches/show.html.erb
@@ -1,4 +1,9 @@
<p>
+ <strong>Status:</strong>
+ <%= @match.status %>
+</p>
+
+<p>
<strong>Tournament:</strong>
<%= @match.tournament.id %>
</p>
diff --git a/app/views/matches/show.json.jbuilder b/app/views/matches/show.json.jbuilder
index fe14010..a3ef588 100644
--- a/app/views/matches/show.json.jbuilder
+++ b/app/views/matches/show.json.jbuilder
@@ -1 +1 @@
-json.extract! @match, :id, :tournament_id, :name, :winner_id, :created_at, :updated_at
+json.extract! @match, :id, :status, :tournament_id, :name, :winner_id, :created_at, :updated_at
diff --git a/app/views/tournaments/_form.html.erb b/app/views/tournaments/_form.html.erb
index d098cbb..38855a0 100644
--- a/app/views/tournaments/_form.html.erb
+++ b/app/views/tournaments/_form.html.erb
@@ -12,6 +12,10 @@
<% end %>
<div class="field">
+ <%= f.label :name %><br>
+ <%= f.text_field :name %>
+ </div>
+ <div class="field">
<%= f.label :game_id %><br>
<%= f.text_field :game_id %>
</div>
diff --git a/app/views/tournaments/index.html.erb b/app/views/tournaments/index.html.erb
index 7fb4a1d..90c3d7a 100644
--- a/app/views/tournaments/index.html.erb
+++ b/app/views/tournaments/index.html.erb
@@ -4,6 +4,7 @@
<table class="table table-hover">
<thead>
<tr>
+ <th>Name</th>
<th>Game</th>
<th>Status</th>
<th>Players per team</th>
@@ -18,7 +19,7 @@
<tbody>
<% @tournaments.each do |tournament| %>
<tr>
- <td><%= tournament.id %></td>
+ <td><%= tournament.name %></td>
<td><% case tournament.status
when 0 %>
<%= form_tag(tournament_path(tournament), method: "put") do %>
diff --git a/app/views/tournaments/index.json.jbuilder b/app/views/tournaments/index.json.jbuilder
index e95c6a7..4038f04 100644
--- a/app/views/tournaments/index.json.jbuilder
+++ b/app/views/tournaments/index.json.jbuilder
@@ -1,4 +1,4 @@
json.array!(@tournaments) do |tournament|
- json.extract! tournament, :id, :game_id, :status, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams
+ json.extract! tournament, :id, :name, :game_id, :status, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams
json.url tournament_url(tournament, format: :json)
end
diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb
index acff3d4..cc0f0e3 100644
--- a/app/views/tournaments/show.html.erb
+++ b/app/views/tournaments/show.html.erb
@@ -1,3 +1,6 @@
+<h2 id="tournament-name">
+ <%= @tournament.name %>
+</h2>
<div class="progress">
<%= tag("div", {:class => "progress-bar progress-bar-warning", :style => "width: " +(@tournament.players.count * 100 / (@tournament.min_players_per_team * @tournament.min_teams_per_match)).to_s + "%", "aria-valuemax" => "100", "aria-valuemin" => "0", "aria-valuenow" => (@tournament.players.count * 100 / (@tournament.min_players_per_team * @tournament.min_teams_per_match)).to_s, "role" => "progressbar"}) %>
@@ -6,15 +9,16 @@
</div>
<p id="players-needed"><%= pluralize(@tournament.players.count, "player has", "players have") %> signed up. <%= @tournament.min_players_per_team * @tournament.min_teams_per_match %> needed. </p>
-<div id="tournament-side-params">
- <p>
- <strong>Game:</strong>
- <%= @tournament.id %>
- </p>
+<span id="tournament-side-params">
+
<p>
<strong>Status:</strong>
- <%= @tournament.status %>
+ <% if @tournament.status == 0 %>
+ Waiting for players...
+ <% else %>
+ Started
+ <% end %>
</p>
<p>
@@ -46,15 +50,19 @@
<strong>Randomized teams:</strong>
<%= @tournament.randomized_teams %>
</p>
-</div>
+</span>
+<div >
<%# Show all players in the tournament %>
<% if @tournament.players.length > 0 %>
+<h3> Players Here: </h3>
<ul id="tournament-users">
<% @tournament.players.each do |p| %>
<li><span class="black"> <%= p.user_name %> </span> </li>
<% end %>
</ul>
+ <% else %>
+ <h3 div="players-needed">Hmmm.... nobody's here yet! You and your friends should join the tournament.</h3>
<% end %>
<%# If user can join, and user hasn't joined already, show the join tournment tag %>
@@ -79,5 +87,5 @@
<%= link_to 'Back', tournaments_path %>
<% end %>
<%end %>
-
+</div>
diff --git a/app/views/tournaments/show.json.jbuilder b/app/views/tournaments/show.json.jbuilder
index de2fbe0..27fd5c0 100644
--- a/app/views/tournaments/show.json.jbuilder
+++ b/app/views/tournaments/show.json.jbuilder
@@ -1 +1 @@
-json.extract! @tournament, :id, :game_id, :status, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :created_at, :updated_at
+json.extract! @tournament, :id, :name, :game_id, :status, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :created_at, :updated_at
diff --git a/db/migrate/20140307052409_create_game_options.rb b/db/migrate/20140307052409_create_game_options.rb
deleted file mode 100644
index 2f62ef7..0000000
--- a/db/migrate/20140307052409_create_game_options.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class CreateGameOptions < ActiveRecord::Migration
- def change
- create_table :game_options do |t|
- t.integer :vartype
- t.string :name
- t.text :default
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20140307052327_create_servers.rb b/db/migrate/20140325214513_create_servers.rb
index f33241a..f33241a 100644
--- a/db/migrate/20140307052327_create_servers.rb
+++ b/db/migrate/20140325214513_create_servers.rb
diff --git a/db/migrate/20140307052331_create_matches.rb b/db/migrate/20140325214516_create_matches.rb
index 67a5b7b..30949a8 100644
--- a/db/migrate/20140307052331_create_matches.rb
+++ b/db/migrate/20140325214516_create_matches.rb
@@ -1,6 +1,7 @@
class CreateMatches < ActiveRecord::Migration
def change
create_table :matches do |t|
+ t.integer :status
t.references :tournament, index: true
t.string :name
t.references :winner, index: true
diff --git a/db/migrate/20140307052334_create_teams.rb b/db/migrate/20140325214518_create_teams.rb
index fdf9a68..fdf9a68 100644
--- a/db/migrate/20140307052334_create_teams.rb
+++ b/db/migrate/20140325214518_create_teams.rb
diff --git a/db/migrate/20140307052338_create_alerts.rb b/db/migrate/20140325214521_create_alerts.rb
index 68a8e10..68a8e10 100644
--- a/db/migrate/20140307052338_create_alerts.rb
+++ b/db/migrate/20140325214521_create_alerts.rb
diff --git a/db/migrate/20140307052342_create_pms.rb b/db/migrate/20140325214523_create_pms.rb
index 93bb5c6..93bb5c6 100644
--- a/db/migrate/20140307052342_create_pms.rb
+++ b/db/migrate/20140325214523_create_pms.rb
diff --git a/db/migrate/20140307052346_create_tournaments.rb b/db/migrate/20140325214525_create_tournaments.rb
index 545e603..c0d8929 100644
--- a/db/migrate/20140307052346_create_tournaments.rb
+++ b/db/migrate/20140325214525_create_tournaments.rb
@@ -1,6 +1,7 @@
class CreateTournaments < ActiveRecord::Migration
def change
create_table :tournaments do |t|
+ t.string :name
t.references :game, index: true
t.integer :status
t.integer :min_players_per_team
diff --git a/db/migrate/20140307052350_create_games.rb b/db/migrate/20140325214528_create_games.rb
index 5e4f56f..5e4f56f 100644
--- a/db/migrate/20140307052350_create_games.rb
+++ b/db/migrate/20140325214528_create_games.rb
diff --git a/db/migrate/20140307052354_create_users.rb b/db/migrate/20140325214531_create_users.rb
index 8032870..8032870 100644
--- a/db/migrate/20140307052354_create_users.rb
+++ b/db/migrate/20140325214531_create_users.rb
diff --git a/db/migrate/20140307052358_create_sessions.rb b/db/migrate/20140325214533_create_sessions.rb
index fe25bf2..fe25bf2 100644
--- a/db/migrate/20140307052358_create_sessions.rb
+++ b/db/migrate/20140325214533_create_sessions.rb
diff --git a/db/migrate/20140307052402_create_server_settings.rb b/db/migrate/20140325214536_create_server_settings.rb
index dfdd91b..dfdd91b 100644
--- a/db/migrate/20140307052402_create_server_settings.rb
+++ b/db/migrate/20140325214536_create_server_settings.rb
diff --git a/db/migrate/20140307052405_create_tournament_options.rb b/db/migrate/20140325214538_create_tournament_options.rb
index 53b601c..53b601c 100644
--- a/db/migrate/20140307052405_create_tournament_options.rb
+++ b/db/migrate/20140325214538_create_tournament_options.rb
diff --git a/db/migrate/20140325214540_create_game_settings.rb b/db/migrate/20140325214540_create_game_settings.rb
new file mode 100644
index 0000000..0ebbf18
--- /dev/null
+++ b/db/migrate/20140325214540_create_game_settings.rb
@@ -0,0 +1,15 @@
+class CreateGameSettings < ActiveRecord::Migration
+ def change
+ create_table :game_settings do |t|
+ t.references :game, index: true
+ t.integer :type
+ t.string :name
+ t.text :default
+ t.text :discription
+ t.text :type_opt
+ t.integer :display_order
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20140307052413_create_scores.rb b/db/migrate/20140325214543_create_scores.rb
index 4ca0b0b..4ca0b0b 100644
--- a/db/migrate/20140307052413_create_scores.rb
+++ b/db/migrate/20140325214543_create_scores.rb
diff --git a/db/migrate/20140307052417_create_tournament_players_join_table.rb b/db/migrate/20140325214545_create_tournament_players_join_table.rb
index be240e8..be240e8 100644
--- a/db/migrate/20140307052417_create_tournament_players_join_table.rb
+++ b/db/migrate/20140325214545_create_tournament_players_join_table.rb
diff --git a/db/migrate/20140307052421_create_tournament_hosts_join_table.rb b/db/migrate/20140325214548_create_tournament_hosts_join_table.rb
index 7521d89..7521d89 100644
--- a/db/migrate/20140307052421_create_tournament_hosts_join_table.rb
+++ b/db/migrate/20140325214548_create_tournament_hosts_join_table.rb
diff --git a/db/migrate/20140307052424_create_team_user_join_table.rb b/db/migrate/20140325214550_create_team_user_join_table.rb
index f3b57fc..f3b57fc 100644
--- a/db/migrate/20140307052424_create_team_user_join_table.rb
+++ b/db/migrate/20140325214550_create_team_user_join_table.rb
diff --git a/db/migrate/20140307052428_create_match_team_join_table.rb b/db/migrate/20140325214553_create_match_team_join_table.rb
index c2ed1b7..c2ed1b7 100644
--- a/db/migrate/20140307052428_create_match_team_join_table.rb
+++ b/db/migrate/20140325214553_create_match_team_join_table.rb
diff --git a/db/migrate/20140307052443_add_hidden_attrs_to_user.rb b/db/migrate/20140325214602_add_hidden_attrs_to_user.rb
index 2f1b0b2..2f1b0b2 100644
--- a/db/migrate/20140307052443_add_hidden_attrs_to_user.rb
+++ b/db/migrate/20140325214602_add_hidden_attrs_to_user.rb
diff --git a/db/schema.rb b/db/schema.rb
index 55f4046..4704a45 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20140307052443) do
+ActiveRecord::Schema.define(version: 20140325214602) do
create_table "alerts", force: true do |t|
t.integer "author_id"
@@ -22,14 +22,20 @@ ActiveRecord::Schema.define(version: 20140307052443) do
add_index "alerts", ["author_id"], name: "index_alerts_on_author_id"
- create_table "game_options", force: true do |t|
- t.integer "vartype"
+ create_table "game_settings", force: true do |t|
+ t.integer "game_id"
+ t.integer "type"
t.string "name"
t.text "default"
+ t.text "discription"
+ t.text "type_opt"
+ t.integer "display_order"
t.datetime "created_at"
t.datetime "updated_at"
end
+ add_index "game_settings", ["game_id"], name: "index_game_settings_on_game_id"
+
create_table "games", force: true do |t|
t.text "name"
t.integer "min_players_per_team"
@@ -48,6 +54,7 @@ ActiveRecord::Schema.define(version: 20140307052443) do
end
create_table "matches", force: true do |t|
+ t.integer "status"
t.integer "tournament_id"
t.string "name"
t.integer "winner_id"
@@ -133,6 +140,7 @@ ActiveRecord::Schema.define(version: 20140307052443) do
add_index "tournament_options", ["tournament_id"], name: "index_tournament_options_on_tournament_id"
create_table "tournaments", force: true do |t|
+ t.string "name"
t.integer "game_id"
t.integer "status"
t.integer "min_players_per_team"
diff --git a/generate.sh b/generate.sh
index 45a8ab6..2013703 100755
--- a/generate.sh
+++ b/generate.sh
@@ -18,11 +18,11 @@ git checkout clean-start -- app test config/routes.rb
# The whole shebang, models, views, and controllers
bundle exec rails generate scaffold server --force $NOTEST
-bundle exec rails generate scaffold match tournament:references name:string winner:references --force $NOTEST
+bundle exec rails generate scaffold match status:integer tournament:references name:string winner:references --force $NOTEST
bundle exec rails generate scaffold team match:references $NOTEST
bundle exec rails generate scaffold alert author:references message:text $NOTEST
bundle exec rails generate scaffold pm author:references recipient:references message:text $NOTEST
-bundle exec rails generate scaffold tournament game:references status:integer \
+bundle exec rails generate scaffold tournament name:string:unique game:references status:integer \
min_players_per_team:integer max_players_per_team:integer \
min_teams_per_match:integer max_teams_per_match:integer \
set_rounds:integer randomized_teams:boolean
@@ -37,7 +37,7 @@ bundle exec rails generate scaffold session user:references
# Just models
bundle exec rails generate model server_settings $NOTEST
bundle exec rails generate model tournament_option tournament:references vartype:integer name:string value:text $NOTEST
-bundle exec rails generate model game_option vartype:integer name:string default:text $NOTEST
+bundle exec rails generate model game_setting game:references type:integer name:string default:text discription:text type_opt:text display_order:integer $NOTEST
bundle exec rails generate model score user:references match:references value:integer $NOTEST
# Join tables
diff --git a/test/controllers/matches_controller_test.rb b/test/controllers/matches_controller_test.rb
index 51b7f37..c3cc7a4 100644
--- a/test/controllers/matches_controller_test.rb
+++ b/test/controllers/matches_controller_test.rb
@@ -18,7 +18,7 @@ class MatchesControllerTest < ActionController::TestCase
test "should create match" do
assert_difference('Match.count') do
- post :create, match: { name: @match.name, tournament_id: @match.tournament_id, winner_id: @match.winner_id }
+ post :create, match: { name: @match.name, status: @match.status, tournament_id: @match.tournament_id, winner_id: @match.winner_id }
end
assert_redirected_to match_path(assigns(:match))
@@ -35,7 +35,7 @@ class MatchesControllerTest < ActionController::TestCase
end
test "should update match" do
- patch :update, id: @match, match: { name: @match.name, tournament_id: @match.tournament_id, winner_id: @match.winner_id }
+ patch :update, id: @match, match: { name: @match.name, status: @match.status, tournament_id: @match.tournament_id, winner_id: @match.winner_id }
assert_redirected_to match_path(assigns(:match))
end
diff --git a/test/controllers/tournaments_controller_test.rb b/test/controllers/tournaments_controller_test.rb
index 02e578a..d5ab2af 100644
--- a/test/controllers/tournaments_controller_test.rb
+++ b/test/controllers/tournaments_controller_test.rb
@@ -18,7 +18,7 @@ class TournamentsControllerTest < ActionController::TestCase
test "should create tournament" do
assert_difference('Tournament.count') do
- post :create, tournament: { game_id: @tournament.game_id, max_players_per_team: @tournament.max_players_per_team, max_teams_per_match: @tournament.max_teams_per_match, min_players_per_team: @tournament.min_players_per_team, min_teams_per_match: @tournament.min_teams_per_match, randomized_teams: @tournament.randomized_teams, set_rounds: @tournament.set_rounds, status: @tournament.status }
+ post :create, tournament: { game_id: @tournament.game_id, max_players_per_team: @tournament.max_players_per_team, max_teams_per_match: @tournament.max_teams_per_match, min_players_per_team: @tournament.min_players_per_team, min_teams_per_match: @tournament.min_teams_per_match, name: @tournament.name, randomized_teams: @tournament.randomized_teams, set_rounds: @tournament.set_rounds, status: @tournament.status }
end
assert_redirected_to tournament_path(assigns(:tournament))
@@ -35,7 +35,7 @@ class TournamentsControllerTest < ActionController::TestCase
end
test "should update tournament" do
- patch :update, id: @tournament, tournament: { game_id: @tournament.game_id, max_players_per_team: @tournament.max_players_per_team, max_teams_per_match: @tournament.max_teams_per_match, min_players_per_team: @tournament.min_players_per_team, min_teams_per_match: @tournament.min_teams_per_match, randomized_teams: @tournament.randomized_teams, set_rounds: @tournament.set_rounds, status: @tournament.status }
+ patch :update, id: @tournament, tournament: { game_id: @tournament.game_id, max_players_per_team: @tournament.max_players_per_team, max_teams_per_match: @tournament.max_teams_per_match, min_players_per_team: @tournament.min_players_per_team, min_teams_per_match: @tournament.min_teams_per_match, name: @tournament.name, randomized_teams: @tournament.randomized_teams, set_rounds: @tournament.set_rounds, status: @tournament.status }
assert_redirected_to tournament_path(assigns(:tournament))
end
diff --git a/test/fixtures/game_options.yml b/test/fixtures/game_settings.yml
index eb4760a..5626c97 100644
--- a/test/fixtures/game_options.yml
+++ b/test/fixtures/game_settings.yml
@@ -1,11 +1,19 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
- vartype: 1
+ game_id:
+ type: 1
name: MyString
default: MyText
+ discription: MyText
+ type_opt: MyText
+ display_order: 1
two:
- vartype: 1
+ game_id:
+ type: 1
name: MyString
default: MyText
+ discription: MyText
+ type_opt: MyText
+ display_order: 1
diff --git a/test/fixtures/matches.yml b/test/fixtures/matches.yml
index 956229c..00af9f5 100644
--- a/test/fixtures/matches.yml
+++ b/test/fixtures/matches.yml
@@ -1,11 +1,13 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
+ status: 1
tournament_id:
name: MyString
winner_id:
two:
+ status: 1
tournament_id:
name: MyString
winner_id:
diff --git a/test/fixtures/tournaments.yml b/test/fixtures/tournaments.yml
index 27c92f9..89edc9f 100644
--- a/test/fixtures/tournaments.yml
+++ b/test/fixtures/tournaments.yml
@@ -1,6 +1,7 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
+ name: MyString
game_id:
status: 1
min_players_per_team: 1
@@ -11,6 +12,7 @@ one:
randomized_teams: false
two:
+ name: MyString
game_id:
status: 1
min_players_per_team: 1
diff --git a/test/models/game_option_test.rb b/test/models/game_setting_test.rb
index 1ae5701..8ab8bcf 100644
--- a/test/models/game_option_test.rb
+++ b/test/models/game_setting_test.rb
@@ -1,6 +1,6 @@
require 'test_helper'
-class GameOptionTest < ActiveSupport::TestCase
+class GameSettingTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end