1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-30 19:22:21 +00:00

Added logic to delegate tournament access

This commit is contained in:
2016-01-06 18:38:02 +00:00
parent eb9037b078
commit f46029efaf
46 changed files with 417 additions and 121 deletions

View File

@@ -36,6 +36,10 @@ class SchoolsControllerTest < ActionController::TestCase
def sign_in_non_owner
sign_in users(:two)
end
def sign_in_tournament_delegate
sign_in users(:three)
end
def success
assert_response :success
@@ -50,6 +54,12 @@ class SchoolsControllerTest < ActionController::TestCase
get_edit
success
end
test "logged in tournament delegate should get edit school page" do
sign_in_tournament_delegate
get_edit
success
end
test "logged in user should not get edit school page if not owner" do
sign_in_non_owner
@@ -78,6 +88,12 @@ class SchoolsControllerTest < ActionController::TestCase
post_update
assert_redirected_to tournament_path(@school.tournament_id)
end
test "logged in tournament delegate should post update school" do
sign_in_tournament_delegate
post_update
assert_redirected_to tournament_path(@school.tournament_id)
end
test "logged in tournament owner can create a new school" do
sign_in_owner
@@ -86,6 +102,14 @@ class SchoolsControllerTest < ActionController::TestCase
create
assert_redirected_to tournament_path(@school.tournament_id)
end
test "logged in tournament delegate can create a new school" do
sign_in_tournament_delegate
new
success
create
assert_redirected_to tournament_path(@school.tournament_id)
end
test "logged in user not tournament owner cannot create a school" do
sign_in_non_owner
@@ -100,6 +124,12 @@ class SchoolsControllerTest < ActionController::TestCase
destroy
assert_redirected_to tournament_path(@tournament.id)
end
test "logged in tournament delegate can destroy a school" do
sign_in_tournament_delegate
destroy
assert_redirected_to tournament_path(@tournament.id)
end
test "logged in user not tournament owner cannot destroy school" do
sign_in_non_owner