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:
@@ -106,5 +106,10 @@ class SchoolsControllerTest < ActionController::TestCase
|
||||
destroy
|
||||
redirect
|
||||
end
|
||||
|
||||
test "view school" do
|
||||
get :show, id: 1
|
||||
success
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -107,5 +107,9 @@ class WeightsControllerTest < ActionController::TestCase
|
||||
redirect
|
||||
end
|
||||
|
||||
test "view wegiht" do
|
||||
get :show, id: 1
|
||||
success
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -108,6 +108,10 @@ class WrestlersControllerTest < ActionController::TestCase
|
||||
redirect
|
||||
end
|
||||
|
||||
test "view wrestler" do
|
||||
get :show, id: @wrestler.id
|
||||
success
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user