summaryrefslogtreecommitdiff
path: root/test
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
parent6e20d92989739bde287c6a07c03ae3f70755660b (diff)
parent068e95231c3d2cee113cf77af67ce785d853429e (diff)
Merge branch 'master' of http://github.com/LukeShu/leaguer
Diffstat (limited to 'test')
-rw-r--r--test/controllers/games_controller_test.rb49
-rw-r--r--test/controllers/tournaments_controller_test.rb4
-rw-r--r--test/fixtures/game_attributes.yml11
-rw-r--r--test/fixtures/games.yml15
-rw-r--r--test/fixtures/tournament_options.yml11
-rw-r--r--test/fixtures/tournaments.yml14
-rw-r--r--test/helpers/games_helper_test.rb4
-rw-r--r--test/models/game_attribute_test.rb7
-rw-r--r--test/models/game_test.rb7
-rw-r--r--test/models/tournament_options_test.rb7
10 files changed, 118 insertions, 11 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
diff --git a/test/fixtures/game_attributes.yml b/test/fixtures/game_attributes.yml
new file mode 100644
index 0000000..eff7212
--- /dev/null
+++ b/test/fixtures/game_attributes.yml
@@ -0,0 +1,11 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
+
+one:
+ game_id:
+ key: MyText
+ type: 1
+
+two:
+ game_id:
+ key: MyText
+ type: 1
diff --git a/test/fixtures/games.yml b/test/fixtures/games.yml
new file mode 100644
index 0000000..3068527
--- /dev/null
+++ b/test/fixtures/games.yml
@@ -0,0 +1,15 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
+
+one:
+ name: MyText
+ players_per_team: 1
+ teams_per_match: 1
+ set_rounds: 1
+ randomized_teams: 1
+
+two:
+ name: MyText
+ players_per_team: 1
+ teams_per_match: 1
+ set_rounds: 1
+ randomized_teams: 1
diff --git a/test/fixtures/tournament_options.yml b/test/fixtures/tournament_options.yml
new file mode 100644
index 0000000..937a0c0
--- /dev/null
+++ b/test/fixtures/tournament_options.yml
@@ -0,0 +1,11 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
+
+# This model initially had no columns defined. If you add columns to the
+# model remove the '{}' from the fixture names and add the columns immediately
+# below each fixture, per the syntax in the comments below
+#
+one: {}
+# column: value
+#
+two: {}
+# column: value
diff --git a/test/fixtures/tournaments.yml b/test/fixtures/tournaments.yml
index 937a0c0..4cba7ca 100644
--- a/test/fixtures/tournaments.yml
+++ b/test/fixtures/tournaments.yml
@@ -1,11 +1,7 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
-# This model initially had no columns defined. If you add columns to the
-# model remove the '{}' from the fixture names and add the columns immediately
-# below each fixture, per the syntax in the comments below
-#
-one: {}
-# column: value
-#
-two: {}
-# column: value
+one:
+ game_id:
+
+two:
+ game_id:
diff --git a/test/helpers/games_helper_test.rb b/test/helpers/games_helper_test.rb
new file mode 100644
index 0000000..449a85c
--- /dev/null
+++ b/test/helpers/games_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class GamesHelperTest < ActionView::TestCase
+end
diff --git a/test/models/game_attribute_test.rb b/test/models/game_attribute_test.rb
new file mode 100644
index 0000000..13c6e65
--- /dev/null
+++ b/test/models/game_attribute_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class GameAttributeTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/test/models/game_test.rb b/test/models/game_test.rb
new file mode 100644
index 0000000..2cab36e
--- /dev/null
+++ b/test/models/game_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class GameTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/test/models/tournament_options_test.rb b/test/models/tournament_options_test.rb
new file mode 100644
index 0000000..7677fae
--- /dev/null
+++ b/test/models/tournament_options_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class TournamentOptionsTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end