mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +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:
@@ -30,6 +30,10 @@ class WeightsControllerTest < ActionController::TestCase
|
||||
get :edit, params: { id: @weight.id }
|
||||
end
|
||||
|
||||
def get_show
|
||||
get :show, params: { id: @weight.id }
|
||||
end
|
||||
|
||||
def get_pool_order
|
||||
post :pool_order, params: {pool_to_order: 1, id: @weight.id}
|
||||
end
|
||||
@@ -210,6 +214,87 @@ class WeightsControllerTest < ActionController::TestCase
|
||||
redirect
|
||||
end
|
||||
|
||||
# SHOW PAGE PERMISSIONS WHEN TOURNAMENT IS NOT PUBLIC
|
||||
test "logged in school delegate cannot get show page when tournament is not public" do
|
||||
@tournament.is_public = false
|
||||
@tournament.save
|
||||
sign_in_school_delegate
|
||||
get_show
|
||||
redirect
|
||||
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
|
||||
|
||||
test "view wegiht" do
|
||||
get :show, params: { id: 1 }
|
||||
success
|
||||
|
||||
Reference in New Issue
Block a user