1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

Tests for non privileged routes

This commit is contained in:
2015-11-05 17:48:09 +00:00
parent 77cda886e6
commit 8a9c56f3f7
5 changed files with 30 additions and 1 deletions

View File

@@ -106,5 +106,10 @@ class SchoolsControllerTest < ActionController::TestCase
destroy
redirect
end
test "view school" do
get :show, id: 1
success
end
end

View File

@@ -25,6 +25,10 @@ class StaticPagesControllerTest < ActionController::TestCase
assert_redirected_to '/static_pages/not_allowed'
end
test "get root page" do
get :home
success
end
end

View File

@@ -7,6 +7,7 @@ include Devise::TestHelpers
@tournament = Tournament.find(1)
@tournament.generateMatchups
@school = @tournament.schools.first
@wrestlers = @tournament.weights.first.wrestlers
end
def post_update
@@ -93,6 +94,17 @@ include Devise::TestHelpers
get :weigh_in_weight, id: 1, weight: 1
redirect
end
test "logged in tournament owner can access post weigh_in_weight" do
sign_in_owner
post :weigh_in, id: 1, weight: 1, wrestler: @wrestlers
end
test "logged in non tournament owner cannot access post weigh_in_weight" do
sign_in_non_owner
post :weigh_in_weight, id: 1, weight: 1, wrestler: @wrestlers
redirect
end
test "logged in tournament owner should get edit tournament page" do

View File

@@ -107,5 +107,9 @@ class WeightsControllerTest < ActionController::TestCase
redirect
end
test "view wegiht" do
get :show, id: 1
success
end
end

View File

@@ -108,6 +108,10 @@ class WrestlersControllerTest < ActionController::TestCase
redirect
end
test "view wrestler" do
get :show, id: @wrestler.id
success
end
end