1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-01 20:25:26 +00:00

Test all controllers for school delegate access

This commit is contained in:
2016-01-07 16:30:30 +00:00
parent 612902aa91
commit 1e9ca0d3b1
4 changed files with 135 additions and 1 deletions

View File

@@ -40,6 +40,10 @@ class WeightsControllerTest < ActionController::TestCase
def sign_in_tournament_delegate
sign_in users(:three)
end
def sign_in_school_delegate
sign_in users(:four)
end
def success
assert_response :success
@@ -66,6 +70,12 @@ class WeightsControllerTest < ActionController::TestCase
get_edit
redirect
end
test "logged school delegate should not get edit weight page if not owner" do
sign_in_school_delegate
get_edit
redirect
end
test "non logged in user should not get edit weight page" do
get_edit
@@ -82,6 +92,12 @@ class WeightsControllerTest < ActionController::TestCase
post_update
redirect
end
test "logged school delegate should not post update weight if not owner" do
sign_in_school_delegate
post_update
redirect
end
test "logged in tournament owner should post update weight" do
sign_in_owner
@@ -118,6 +134,14 @@ class WeightsControllerTest < ActionController::TestCase
create
redirect
end
test "logged school delegate not tournament owner cannot create a weight" do
sign_in_school_delegate
new
redirect
create
redirect
end
test "logged in tournament owner can destroy a weight" do
sign_in_owner
@@ -136,6 +160,12 @@ class WeightsControllerTest < ActionController::TestCase
destroy
redirect
end
test "logged school delegate not tournament owner cannot destroy weight" do
sign_in_school_delegate
destroy
redirect
end
test "view wegiht" do
get :show, id: 1