1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

Added a QR code page that generates a QR code for tournament directors to print out.

This commit is contained in:
2026-02-11 18:23:14 -05:00
parent d57aaac09d
commit ae8d995b2c
7 changed files with 114 additions and 6 deletions

View File

@@ -27,6 +27,10 @@ class TournamentsControllerTest < ActionController::TestCase
def get_up_matches
get :up_matches, params: { id: 1 }
end
def get_qrcode(params = {})
get :qrcode, params: { id: 1 }.merge(params)
end
def get_edit
get :edit, params: { id: 1 }
@@ -192,6 +196,47 @@ class TournamentsControllerTest < ActionController::TestCase
assert_redirected_to '/static_pages/not_allowed'
end
test "logged in non owner and non delegate cannot access qrcode" do
sign_in_non_owner
get_qrcode
redirect
end
test "non logged in user cannot access qrcode" do
get_qrcode
redirect
end
test "non logged in user with valid school permission key cannot access qrcode" do
@school.update(permission_key: "valid-key")
get_qrcode(school_permission_key: "valid-key")
redirect
end
test "non logged in user with invalid school permission key cannot access qrcode" do
@school.update(permission_key: "valid-key")
get_qrcode(school_permission_key: "invalid-key")
redirect
end
test "logged in owner can access qrcode" do
sign_in_owner
get_qrcode
success
end
test "logged in tournament delegate can access qrcode" do
sign_in_delegate
get_qrcode
success
end
test "logged in school delegate cannot access qrcode" do
sign_in_school_delegate
get_qrcode
redirect
end
test "logged in user should not post update tournament if not owner" do
sign_in_non_owner
post_update