1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-31 03:25:45 +00:00

Added is_public to a tournament to hide lineups and brackets until you're ready to make it public

This commit is contained in:
2023-01-01 23:16:12 -05:00
parent d675337d7a
commit c328bbd91c
15 changed files with 547 additions and 16 deletions

View File

@@ -17,6 +17,10 @@ class SchoolsControllerTest < ActionController::TestCase
get :new, params: { tournament: @tournament.id }
end
def get_show
get :show, params: { id: @school.id }
end
def post_update
patch :update, params: { id: @school.id, school: {name: @school.name, tournament_id: @school.tournament_id} }
end
@@ -205,4 +209,85 @@ Some Guy
redirect
end
# SHOW PAGE PERMISSIONS WHEN TOURNAMENT IS NOT PUBLIC
test "logged in school delegate can get show page when tournament is not public" do
@tournament.is_public = false
@tournament.save
sign_in_school_delegate
get_show
success
end
test "logged in user cannot get show page when tournament is not public" do
@tournament.is_public = false
@tournament.save
sign_in_non_owner
get_show
redirect
end
test "logged in tournament delegate can get show page when tournament is not public" do
@tournament.is_public = false
@tournament.save
sign_in_tournament_delegate
get_show
success
end
test "logged in tournament owner can get show page when tournament is not public" do
@tournament.is_public = false
@tournament.save
sign_in_owner
get_show
success
end
test "non logged in user cannot get show page when tournament is not public" do
@tournament.is_public = false
@tournament.save
get_show
redirect
end
# SHOW PAGE PERMISSIONS WHEN TOURNAMENT IS PUBLIC
test "logged in school delegate can get show page when tournament is public" do
@tournament.is_public = true
@tournament.save
sign_in_school_delegate
get_show
success
end
test "logged in user can get show page when tournament is public" do
@tournament.is_public = true
@tournament.save
sign_in_non_owner
get_show
success
end
test "logged in tournament delegate can get show page when tournament is public" do
@tournament.is_public = true
@tournament.save
sign_in_tournament_delegate
get_show
success
end
test "logged in tournament owner can get show page when tournament is public" do
@tournament.is_public = true
@tournament.save
sign_in_owner
get_show
success
end
test "non logged in user can get show page when tournament is public" do
@tournament.is_public = true
@tournament.save
get_show
success
end
# END SHOW PAGE PERMISSIONS
end