summaryrefslogtreecommitdiff
path: root/test/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'test/controllers')
-rw-r--r--test/controllers/alerts_controller_test.rb49
-rw-r--r--test/controllers/main_controller_test.rb7
-rw-r--r--test/controllers/matches_controller_test.rb4
-rw-r--r--test/controllers/pms_controller_test.rb49
-rw-r--r--test/controllers/search_controller_test.rb7
-rw-r--r--test/controllers/users_controller_test.rb4
6 files changed, 116 insertions, 4 deletions
diff --git a/test/controllers/alerts_controller_test.rb b/test/controllers/alerts_controller_test.rb
new file mode 100644
index 0000000..29e58e9
--- /dev/null
+++ b/test/controllers/alerts_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class AlertsControllerTest < ActionController::TestCase
+ setup do
+ @alert = alerts(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:alerts)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create alert" do
+ assert_difference('Alert.count') do
+ post :create, alert: { author: @alert.author, message: @alert.message }
+ end
+
+ assert_redirected_to alert_path(assigns(:alert))
+ end
+
+ test "should show alert" do
+ get :show, id: @alert
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @alert
+ assert_response :success
+ end
+
+ test "should update alert" do
+ patch :update, id: @alert, alert: { author: @alert.author, message: @alert.message }
+ assert_redirected_to alert_path(assigns(:alert))
+ end
+
+ test "should destroy alert" do
+ assert_difference('Alert.count', -1) do
+ delete :destroy, id: @alert
+ end
+
+ assert_redirected_to alerts_path
+ end
+end
diff --git a/test/controllers/main_controller_test.rb b/test/controllers/main_controller_test.rb
new file mode 100644
index 0000000..b7ec6bf
--- /dev/null
+++ b/test/controllers/main_controller_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class MainControllerTest < ActionController::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/test/controllers/matches_controller_test.rb b/test/controllers/matches_controller_test.rb
index 353ff4b..629622b 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: { }
+ post :create, match: { tournament: @match.tournament }
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: { }
+ patch :update, id: @match, match: { tournament: @match.tournament }
assert_redirected_to match_path(assigns(:match))
end
diff --git a/test/controllers/pms_controller_test.rb b/test/controllers/pms_controller_test.rb
new file mode 100644
index 0000000..ccbe7b1
--- /dev/null
+++ b/test/controllers/pms_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class PmsControllerTest < ActionController::TestCase
+ setup do
+ @pm = pms(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:pms)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create pm" do
+ assert_difference('Pm.count') do
+ post :create, pm: { author: @pm.author, message: @pm.message, recipient: @pm.recipient }
+ end
+
+ assert_redirected_to pm_path(assigns(:pm))
+ end
+
+ test "should show pm" do
+ get :show, id: @pm
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @pm
+ assert_response :success
+ end
+
+ test "should update pm" do
+ patch :update, id: @pm, pm: { author: @pm.author, message: @pm.message, recipient: @pm.recipient }
+ assert_redirected_to pm_path(assigns(:pm))
+ end
+
+ test "should destroy pm" do
+ assert_difference('Pm.count', -1) do
+ delete :destroy, id: @pm
+ end
+
+ assert_redirected_to pms_path
+ end
+end
diff --git a/test/controllers/search_controller_test.rb b/test/controllers/search_controller_test.rb
new file mode 100644
index 0000000..bfbf22d
--- /dev/null
+++ b/test/controllers/search_controller_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class SearchControllerTest < ActionController::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb
index 846e74c..8bcd10b 100644
--- a/test/controllers/users_controller_test.rb
+++ b/test/controllers/users_controller_test.rb
@@ -18,7 +18,7 @@ class UsersControllerTest < ActionController::TestCase
test "should create user" do
assert_difference('User.count') do
- post :create, user: { }
+ post :create, user: { groups: @user.groups, name: @user.name, pw_hash: @user.pw_hash }
end
assert_redirected_to user_path(assigns(:user))
@@ -35,7 +35,7 @@ class UsersControllerTest < ActionController::TestCase
end
test "should update user" do
- patch :update, id: @user, user: { }
+ patch :update, id: @user, user: { groups: @user.groups, name: @user.name, pw_hash: @user.pw_hash }
assert_redirected_to user_path(assigns(:user))
end