mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-06 06:28:33 +00:00
Tests for non privileged routes
This commit is contained in:
@@ -107,4 +107,9 @@ class SchoolsControllerTest < ActionController::TestCase
|
|||||||
redirect
|
redirect
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "view school" do
|
||||||
|
get :show, id: 1
|
||||||
|
success
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ class StaticPagesControllerTest < ActionController::TestCase
|
|||||||
assert_redirected_to '/static_pages/not_allowed'
|
assert_redirected_to '/static_pages/not_allowed'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "get root page" do
|
||||||
|
get :home
|
||||||
|
success
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ include Devise::TestHelpers
|
|||||||
@tournament = Tournament.find(1)
|
@tournament = Tournament.find(1)
|
||||||
@tournament.generateMatchups
|
@tournament.generateMatchups
|
||||||
@school = @tournament.schools.first
|
@school = @tournament.schools.first
|
||||||
|
@wrestlers = @tournament.weights.first.wrestlers
|
||||||
end
|
end
|
||||||
|
|
||||||
def post_update
|
def post_update
|
||||||
@@ -94,6 +95,17 @@ include Devise::TestHelpers
|
|||||||
redirect
|
redirect
|
||||||
end
|
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
|
test "logged in tournament owner should get edit tournament page" do
|
||||||
sign_in_owner
|
sign_in_owner
|
||||||
|
|||||||
@@ -107,5 +107,9 @@ class WeightsControllerTest < ActionController::TestCase
|
|||||||
redirect
|
redirect
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "view wegiht" do
|
||||||
|
get :show, id: 1
|
||||||
|
success
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -108,6 +108,10 @@ class WrestlersControllerTest < ActionController::TestCase
|
|||||||
redirect
|
redirect
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "view wrestler" do
|
||||||
|
get :show, id: @wrestler.id
|
||||||
|
success
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user