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

Upgraded to rails 8.0.2, moved from dalli to solid cache, moved from delayed_job to solid queue, and add solid cable. deploy/rails-dev-run.sh no longer needs to chmod. Fixed finished_at callback for matches. Migrated from Devise to built in rails auth. Added view tests for the bracket page testing that all bout numbers render for all matches in each bracket type.

This commit is contained in:
2025-04-08 17:54:42 -04:00
parent 9c25a6cc39
commit 2d433b680a
118 changed files with 4921 additions and 1341 deletions

View File

@@ -1,7 +1,8 @@
require 'test_helper'
class TournamentsControllerTest < ActionController::TestCase
include Devise::Test::ControllerHelpers
# Remove Devise helpers since we're no longer using Devise
# include Devise::Test::ControllerHelpers
setup do
@tournament = Tournament.find(1)
@@ -934,4 +935,153 @@ class TournamentsControllerTest < ActionController::TestCase
post :delete_school_keys, params: { id: @tournament.id }
redirect
end
# TESTS FOR BRACKET MATCH RENDERING
test "all match bout numbers render in double elimination bracket page" do
sign_in_owner
create_double_elim_tournament_single_weight(14, "Regular Double Elimination 1-8")
get :bracket, params: { id: @tournament.id, weight: @tournament.weights.first.id }
assert_response :success
# Verify all bout numbers appear in the HTML response
@tournament.matches.each do |match|
assert_match(/#{match.bout_number}/, response.body, "Bout number #{match.bout_number} is missing from the bracket page")
end
end
test "all match bout numbers render in modified double elimination bracket page" do
sign_in_owner
create_double_elim_tournament_single_weight(14, "Modified 16 Man Double Elimination 1-8")
get :bracket, params: { id: @tournament.id, weight: @tournament.weights.first.id }
assert_response :success
# Verify all bout numbers appear in the HTML response
@tournament.matches.each do |match|
assert_match(/#{match.bout_number}/, response.body, "Bout number #{match.bout_number} is missing from the bracket page")
end
end
test "all match bout numbers render in pool to bracket (two pools to semi) page" do
sign_in_owner
create_pool_tournament_single_weight(8)
get :bracket, params: { id: @tournament.id, weight: @tournament.weights.first.id }
assert_response :success
# Verify all bracket match bout numbers appear in the HTML response
@tournament.matches.where.not(bracket_position: "Pool").each do |match|
assert_match(/#{match.bout_number}/, response.body, "Bout number #{match.bout_number} is missing from the bracket page")
end
# For pool matches, they should appear in the pool section
pool_matches = @tournament.matches.where(bracket_position: "Pool")
pool_matches.each do |match|
assert_match(/#{match.bout_number}/, response.body, "Pool bout number #{match.bout_number} is missing from the bracket page")
end
end
test "all match bout numbers render in pool to bracket (four pools to quarter) page" do
sign_in_owner
create_pool_tournament_single_weight(12)
get :bracket, params: { id: @tournament.id, weight: @tournament.weights.first.id }
assert_response :success
# Verify all bracket match bout numbers appear in the HTML response
@tournament.matches.where.not(bracket_position: "Pool").each do |match|
assert_match(/#{match.bout_number}/, response.body, "Bout number #{match.bout_number} is missing from the bracket page")
end
# For pool matches, they should appear in the pool section
pool_matches = @tournament.matches.where(bracket_position: "Pool")
pool_matches.each do |match|
assert_match(/#{match.bout_number}/, response.body, "Pool bout number #{match.bout_number} is missing from the bracket page")
end
end
test "all match bout numbers render in pool to bracket (four pools to semi) page" do
sign_in_owner
create_pool_tournament_single_weight(16)
get :bracket, params: { id: @tournament.id, weight: @tournament.weights.first.id }
assert_response :success
# Verify all bracket match bout numbers appear in the HTML response
@tournament.matches.where.not(bracket_position: "Pool").each do |match|
assert_match(/#{match.bout_number}/, response.body, "Bout number #{match.bout_number} is missing from the bracket page")
end
# For pool matches, they should appear in the pool section
pool_matches = @tournament.matches.where(bracket_position: "Pool")
pool_matches.each do |match|
assert_match(/#{match.bout_number}/, response.body, "Pool bout number #{match.bout_number} is missing from the bracket page")
end
end
test "all match bout numbers render in pool to bracket (two pools to final) page" do
sign_in_owner
create_pool_tournament_single_weight(10)
get :bracket, params: { id: @tournament.id, weight: @tournament.weights.first.id }
assert_response :success
# Verify all bracket match bout numbers appear in the HTML response
@tournament.matches.where.not(bracket_position: "Pool").each do |match|
assert_match(/#{match.bout_number}/, response.body, "Bout number #{match.bout_number} is missing from the bracket page")
end
# For pool matches, they should appear in the pool section
pool_matches = @tournament.matches.where(bracket_position: "Pool")
pool_matches.each do |match|
assert_match(/#{match.bout_number}/, response.body, "Pool bout number #{match.bout_number} is missing from the bracket page")
end
end
test "all match bout numbers render in pool to bracket (eight pools) page" do
sign_in_owner
create_pool_tournament_single_weight(24)
get :bracket, params: { id: @tournament.id, weight: @tournament.weights.first.id }
assert_response :success
# Verify all bracket match bout numbers appear in the HTML response
@tournament.matches.where.not(bracket_position: "Pool").each do |match|
assert_match(/#{match.bout_number}/, response.body, "Bout number #{match.bout_number} is missing from the bracket page")
end
# For pool matches, they should appear in the pool section
pool_matches = @tournament.matches.where(bracket_position: "Pool")
pool_matches.each do |match|
assert_match(/#{match.bout_number}/, response.body, "Pool bout number #{match.bout_number} is missing from the bracket page")
end
end
test "all match bout numbers render in double elimination 8-man bracket page" do
sign_in_owner
create_double_elim_tournament_single_weight_1_6(6)
get :bracket, params: { id: @tournament.id, weight: @tournament.weights.first.id }
assert_response :success
# Verify all bout numbers appear in the HTML response
@tournament.matches.each do |match|
assert_match(/#{match.bout_number}/, response.body, "Bout number #{match.bout_number} is missing from the bracket page")
end
end
test "all match bout numbers render in double elimination 32-man bracket page" do
sign_in_owner
create_double_elim_tournament_single_weight(30, "Regular Double Elimination 1-8")
get :bracket, params: { id: @tournament.id, weight: @tournament.weights.first.id }
assert_response :success
# Verify all bout numbers appear in the HTML response
@tournament.matches.each do |match|
assert_match(/#{match.bout_number}/, response.body, "Bout number #{match.bout_number} is missing from the bracket page")
end
end
end