summaryrefslogtreecommitdiff
path: root/test/controllers
diff options
context:
space:
mode:
authorDavisLWebb <davislwebb@ymail.com>2014-02-27 17:58:14 -0500
committerDavisLWebb <davislwebb@ymail.com>2014-02-27 17:58:14 -0500
commit8d75a450ec1e34205ec4bee5587e8bddb9c89d21 (patch)
tree349c6cd9c9669c94675becdeeaac1c29fd60022e /test/controllers
parent6e20d92989739bde287c6a07c03ae3f70755660b (diff)
parent068e95231c3d2cee113cf77af67ce785d853429e (diff)
Merge branch 'master' of http://github.com/LukeShu/leaguer
Diffstat (limited to 'test/controllers')
-rw-r--r--test/controllers/games_controller_test.rb49
-rw-r--r--test/controllers/tournaments_controller_test.rb4
2 files changed, 51 insertions, 2 deletions
diff --git a/test/controllers/games_controller_test.rb b/test/controllers/games_controller_test.rb
new file mode 100644
index 0000000..95c3145
--- /dev/null
+++ b/test/controllers/games_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class GamesControllerTest < ActionController::TestCase
+ setup do
+ @game = games(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:games)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create game" do
+ assert_difference('Game.count') do
+ post :create, game: { name: @game.name, players_per_team: @game.players_per_team, randomized_teams: @game.randomized_teams, set_rounds: @game.set_rounds, teams_per_match: @game.teams_per_match }
+ end
+
+ assert_redirected_to game_path(assigns(:game))
+ end
+
+ test "should show game" do
+ get :show, id: @game
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @game
+ assert_response :success
+ end
+
+ test "should update game" do
+ patch :update, id: @game, game: { name: @game.name, players_per_team: @game.players_per_team, randomized_teams: @game.randomized_teams, set_rounds: @game.set_rounds, teams_per_match: @game.teams_per_match }
+ assert_redirected_to game_path(assigns(:game))
+ end
+
+ test "should destroy game" do
+ assert_difference('Game.count', -1) do
+ delete :destroy, id: @game
+ end
+
+ assert_redirected_to games_path
+ end
+end
diff --git a/test/controllers/tournaments_controller_test.rb b/test/controllers/tournaments_controller_test.rb
index 9363bdf..bdbbfac 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: { }
+ post :create, tournament: { game_id: @tournament.game_id }
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: { }
+ patch :update, id: @tournament, tournament: { game_id: @tournament.game_id }
assert_redirected_to tournament_path(assigns(:tournament))
end