mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-02 21:24:25 +00:00
Removed all of the @s from integration tests
This commit is contained in:
@@ -3,7 +3,7 @@ require 'test_helper'
|
||||
class PoolbracketMatchupsTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
@tournament = Tournament.find(1)
|
||||
@genMatchups = @tournament.generateMatchups
|
||||
@tournament.generateMatchups
|
||||
end
|
||||
|
||||
def createTournament(numberOfWrestlers)
|
||||
@@ -98,7 +98,7 @@ class PoolbracketMatchupsTest < ActionDispatch::IntegrationTest
|
||||
end
|
||||
|
||||
test "tests bout numbers correspond to round" do
|
||||
matchup_to_test = @genMatchups.select{|m| m.bout_number == 4000}.first
|
||||
matchup_to_test = @tournament.matches.select{|m| m.bout_number == 4000}.first
|
||||
assert_equal 4, matchup_to_test.round
|
||||
end
|
||||
|
||||
@@ -109,28 +109,28 @@ class PoolbracketMatchupsTest < ActionDispatch::IntegrationTest
|
||||
end
|
||||
|
||||
test "tests number of matches in 5 man one pool" do
|
||||
@six_matches = @genMatchups.select{|m| m.weight_max == 106}
|
||||
assert_equal 10, @six_matches.length
|
||||
six_matches = @tournament.matches.select{|m| m.weight_max == 106}
|
||||
assert_equal 10, six_matches.length
|
||||
end
|
||||
|
||||
test "tests number of matches in 11 man pool bracket" do
|
||||
@twentysix_matches = @genMatchups.select{|m| m.weight_max == 126}
|
||||
assert_equal 22, @twentysix_matches.length
|
||||
twentysix_matches = @tournament.matches.select{|m| m.weight_max == 126}
|
||||
assert_equal 22, twentysix_matches.length
|
||||
end
|
||||
|
||||
test "tests number of matches in 9 man pool bracket" do
|
||||
@twentysix_matches = @genMatchups.select{|m| m.weight_max == 113}
|
||||
assert_equal 18, @twentysix_matches.length
|
||||
twentysix_matches = @tournament.matches.select{|m| m.weight_max == 113}
|
||||
assert_equal 18, twentysix_matches.length
|
||||
end
|
||||
|
||||
test "tests number of matches in 7 man pool bracket" do
|
||||
@twentysix_matches = @genMatchups.select{|m| m.weight_max == 120}
|
||||
assert_equal 13, @twentysix_matches.length
|
||||
twentysix_matches = @tournament.matches.select{|m| m.weight_max == 120}
|
||||
assert_equal 13, twentysix_matches.length
|
||||
end
|
||||
|
||||
test "tests number of matches in 16 man pool bracket" do
|
||||
@twentysix_matches = @genMatchups.select{|m| m.weight_max == 132}
|
||||
assert_equal 32, @twentysix_matches.length
|
||||
twentysix_matches = @tournament.matches.select{|m| m.weight_max == 132}
|
||||
assert_equal 32, twentysix_matches.length
|
||||
end
|
||||
|
||||
test "test if a wrestler can exceed five matches" do
|
||||
@@ -141,112 +141,112 @@ class PoolbracketMatchupsTest < ActionDispatch::IntegrationTest
|
||||
end
|
||||
|
||||
test "test loser names for 16 man bracket 3/4th place match" do
|
||||
@matches = @tournament.matches.where(weight_id: 5)
|
||||
@semi_bouts = @matches.where(bracket_position: 'Semis')
|
||||
@third_fourth_match = @matches.where(bracket_position: '3/4').first
|
||||
assert_equal "Loser of #{@semi_bouts.first.bout_number}", @third_fourth_match.loser1_name
|
||||
assert_equal "Loser of #{@semi_bouts.second.bout_number}", @third_fourth_match.loser2_name
|
||||
matches = @tournament.matches.where(weight_id: 5)
|
||||
semi_bouts = matches.where(bracket_position: 'Semis')
|
||||
third_fourth_match = matches.where(bracket_position: '3/4').first
|
||||
assert_equal "Loser of #{semi_bouts.first.bout_number}", third_fourth_match.loser1_name
|
||||
assert_equal "Loser of #{semi_bouts.second.bout_number}", third_fourth_match.loser2_name
|
||||
end
|
||||
|
||||
test "test loser names for 16 man bracket 7/8th place match" do
|
||||
@matches = @tournament.matches.where(weight_id: 5)
|
||||
@conso_semi_bouts = @matches.where(bracket_position: 'Conso Semis')
|
||||
@seven_eight_match = @matches.where(bracket_position: '7/8').first
|
||||
assert_equal "Loser of #{@conso_semi_bouts.first.bout_number}", @seven_eight_match.loser1_name
|
||||
assert_equal "Loser of #{@conso_semi_bouts.second.bout_number}", @seven_eight_match.loser2_name
|
||||
matches = @tournament.matches.where(weight_id: 5)
|
||||
conso_semi_bouts = matches.where(bracket_position: 'Conso Semis')
|
||||
seven_eight_match = matches.where(bracket_position: '7/8').first
|
||||
assert_equal "Loser of #{conso_semi_bouts.first.bout_number}", seven_eight_match.loser1_name
|
||||
assert_equal "Loser of #{conso_semi_bouts.second.bout_number}", seven_eight_match.loser2_name
|
||||
end
|
||||
|
||||
test "test loser names for 16 man bracket semis" do
|
||||
@matches = @tournament.matches.where(weight_id: 5)
|
||||
@semi_bouts = @matches.where(bracket_position: 'Semis')
|
||||
assert_equal "Winner Pool 1", @semi_bouts.first.loser1_name
|
||||
assert_equal "Winner Pool 4", @semi_bouts.first.loser2_name
|
||||
assert_equal "Winner Pool 2", @semi_bouts.second.loser1_name
|
||||
assert_equal "Winner Pool 3", @semi_bouts.second.loser2_name
|
||||
matches = @tournament.matches.where(weight_id: 5)
|
||||
semi_bouts = matches.where(bracket_position: 'Semis')
|
||||
assert_equal "Winner Pool 1", semi_bouts.first.loser1_name
|
||||
assert_equal "Winner Pool 4", semi_bouts.first.loser2_name
|
||||
assert_equal "Winner Pool 2", semi_bouts.second.loser1_name
|
||||
assert_equal "Winner Pool 3", semi_bouts.second.loser2_name
|
||||
end
|
||||
|
||||
test "test loser names for 16 man bracket conso semis" do
|
||||
@matches = @tournament.matches.where(weight_id: 5)
|
||||
@conso_semi_bouts = @matches.where(bracket_position: 'Conso Semis')
|
||||
assert_equal "Runner Up Pool 1", @conso_semi_bouts.first.loser1_name
|
||||
assert_equal "Runner Up Pool 4", @conso_semi_bouts.first.loser2_name
|
||||
assert_equal "Runner Up Pool 2", @conso_semi_bouts.second.loser1_name
|
||||
assert_equal "Runner Up Pool 3", @conso_semi_bouts.second.loser2_name
|
||||
matches = @tournament.matches.where(weight_id: 5)
|
||||
conso_semi_bouts = matches.where(bracket_position: 'Conso Semis')
|
||||
assert_equal "Runner Up Pool 1", conso_semi_bouts.first.loser1_name
|
||||
assert_equal "Runner Up Pool 4", conso_semi_bouts.first.loser2_name
|
||||
assert_equal "Runner Up Pool 2", conso_semi_bouts.second.loser1_name
|
||||
assert_equal "Runner Up Pool 3", conso_semi_bouts.second.loser2_name
|
||||
end
|
||||
|
||||
|
||||
test "test loser names for 11 man bracket 3/4th place match" do
|
||||
@matches = @tournament.matches.where(weight_id: 4)
|
||||
@semi_bouts = @matches.where(bracket_position: 'Semis')
|
||||
@third_fourth_match = @matches.where(bracket_position: '3/4').first
|
||||
assert_equal "Loser of #{@semi_bouts.first.bout_number}", @third_fourth_match.loser1_name
|
||||
assert_equal "Loser of #{@semi_bouts.second.bout_number}", @third_fourth_match.loser2_name
|
||||
matches = @tournament.matches.where(weight_id: 4)
|
||||
semi_bouts = matches.where(bracket_position: 'Semis')
|
||||
third_fourth_match = matches.where(bracket_position: '3/4').first
|
||||
assert_equal "Loser of #{semi_bouts.first.bout_number}", third_fourth_match.loser1_name
|
||||
assert_equal "Loser of #{semi_bouts.second.bout_number}", third_fourth_match.loser2_name
|
||||
end
|
||||
|
||||
test "test loser names for 11 man bracket 7/8th place match" do
|
||||
@matches = @tournament.matches.where(weight_id: 4)
|
||||
@conso_semi_bouts = @matches.where(bracket_position: 'Conso Semis')
|
||||
@seven_eight_match = @matches.where(bracket_position: '7/8').first
|
||||
assert_equal "Loser of #{@conso_semi_bouts.first.bout_number}", @seven_eight_match.loser1_name
|
||||
assert_equal "Loser of #{@conso_semi_bouts.second.bout_number}", @seven_eight_match.loser2_name
|
||||
matches = @tournament.matches.where(weight_id: 4)
|
||||
conso_semi_bouts = matches.where(bracket_position: 'Conso Semis')
|
||||
seven_eight_match = matches.where(bracket_position: '7/8').first
|
||||
assert_equal "Loser of #{conso_semi_bouts.first.bout_number}", seven_eight_match.loser1_name
|
||||
assert_equal "Loser of #{conso_semi_bouts.second.bout_number}", seven_eight_match.loser2_name
|
||||
end
|
||||
|
||||
test "test loser names for 11 man bracket quarters" do
|
||||
@matches = @tournament.matches.where(weight_id: 4)
|
||||
@quarters = @matches.where(bracket_position: 'Quarter')
|
||||
assert_equal "Winner Pool 1", @quarters.first.loser1_name
|
||||
assert_equal "Runner Up Pool 2", @quarters.first.loser2_name
|
||||
assert_equal "Winner Pool 4", @quarters.second.loser1_name
|
||||
assert_equal "Runner Up Pool 3", @quarters.second.loser2_name
|
||||
assert_equal "Winner Pool 2", @quarters.third.loser1_name
|
||||
assert_equal "Runner Up Pool 1", @quarters.third.loser2_name
|
||||
assert_equal "Winner Pool 3", @quarters.fourth.loser1_name
|
||||
assert_equal "Runner Up Pool 4", @quarters.fourth.loser2_name
|
||||
matches = @tournament.matches.where(weight_id: 4)
|
||||
quarters = matches.where(bracket_position: 'Quarter')
|
||||
assert_equal "Winner Pool 1", quarters.first.loser1_name
|
||||
assert_equal "Runner Up Pool 2", quarters.first.loser2_name
|
||||
assert_equal "Winner Pool 4", quarters.second.loser1_name
|
||||
assert_equal "Runner Up Pool 3", quarters.second.loser2_name
|
||||
assert_equal "Winner Pool 2", quarters.third.loser1_name
|
||||
assert_equal "Runner Up Pool 1", quarters.third.loser2_name
|
||||
assert_equal "Winner Pool 3", quarters.fourth.loser1_name
|
||||
assert_equal "Runner Up Pool 4", quarters.fourth.loser2_name
|
||||
end
|
||||
|
||||
test "test loser names for 11 man bracket conso semis" do
|
||||
@matches = @tournament.matches.where(weight_id: 4)
|
||||
@quarters = @matches.where(bracket_position: 'Quarter')
|
||||
@conso_semi_bouts = @matches.where(bracket_position: 'Conso Semis')
|
||||
assert_equal "Loser of #{@quarters.first.bout_number}", @conso_semi_bouts.first.loser1_name
|
||||
assert_equal "Loser of #{@quarters.second.bout_number}", @conso_semi_bouts.first.loser2_name
|
||||
assert_equal "Loser of #{@quarters.third.bout_number}", @conso_semi_bouts.second.loser1_name
|
||||
assert_equal "Loser of #{@quarters.fourth.bout_number}", @conso_semi_bouts.second.loser2_name
|
||||
matches = @tournament.matches.where(weight_id: 4)
|
||||
quarters = matches.where(bracket_position: 'Quarter')
|
||||
conso_semi_bouts = matches.where(bracket_position: 'Conso Semis')
|
||||
assert_equal "Loser of #{quarters.first.bout_number}", conso_semi_bouts.first.loser1_name
|
||||
assert_equal "Loser of #{quarters.second.bout_number}", conso_semi_bouts.first.loser2_name
|
||||
assert_equal "Loser of #{quarters.third.bout_number}", conso_semi_bouts.second.loser1_name
|
||||
assert_equal "Loser of #{quarters.fourth.bout_number}", conso_semi_bouts.second.loser2_name
|
||||
end
|
||||
|
||||
test "test loser names for 9 man bracket 3/4th place match" do
|
||||
@matches = @tournament.matches.where(weight_id: 3)
|
||||
@third_fourth_match = @matches.where(bracket_position: '3/4').first
|
||||
assert_equal "Runner Up Pool 1", @third_fourth_match.loser1_name
|
||||
assert_equal "Runner Up Pool 2", @third_fourth_match.loser2_name
|
||||
matches = @tournament.matches.where(weight_id: 3)
|
||||
third_fourth_match = matches.where(bracket_position: '3/4').first
|
||||
assert_equal "Runner Up Pool 1", third_fourth_match.loser1_name
|
||||
assert_equal "Runner Up Pool 2", third_fourth_match.loser2_name
|
||||
end
|
||||
|
||||
test "test loser names for 9 man bracket 1/2 place match" do
|
||||
@matches = @tournament.matches.where(weight_id: 3)
|
||||
@final_match = @matches.where(bracket_position: '1/2').first
|
||||
assert_equal "Winner Pool 1", @final_match.loser1_name
|
||||
assert_equal "Winner Pool 2", @final_match.loser2_name
|
||||
matches = @tournament.matches.where(weight_id: 3)
|
||||
final_match = matches.where(bracket_position: '1/2').first
|
||||
assert_equal "Winner Pool 1", final_match.loser1_name
|
||||
assert_equal "Winner Pool 2", final_match.loser2_name
|
||||
end
|
||||
|
||||
test "test loser names for 7 man bracket 3/4th place match" do
|
||||
@matches = @tournament.matches.where(weight_id: 2)
|
||||
@semi_bouts = @matches.where(bracket_position: 'Semis')
|
||||
@third_fourth_match = @matches.where(bracket_position: '3/4').first
|
||||
assert_equal "Loser of #{@semi_bouts.first.bout_number}", @third_fourth_match.loser1_name
|
||||
assert_equal "Loser of #{@semi_bouts.second.bout_number}", @third_fourth_match.loser2_name
|
||||
matches = @tournament.matches.where(weight_id: 2)
|
||||
semi_bouts = matches.where(bracket_position: 'Semis')
|
||||
third_fourth_match = matches.where(bracket_position: '3/4').first
|
||||
assert_equal "Loser of #{semi_bouts.first.bout_number}", third_fourth_match.loser1_name
|
||||
assert_equal "Loser of #{semi_bouts.second.bout_number}", third_fourth_match.loser2_name
|
||||
end
|
||||
|
||||
test "test loser names for 7 man bracket semis" do
|
||||
@matches = @tournament.matches.where(weight_id: 2)
|
||||
@semi_bouts = @matches.where(bracket_position: 'Semis')
|
||||
assert_equal "Winner Pool 1", @semi_bouts.first.loser1_name
|
||||
assert_equal "Runner Up Pool 2", @semi_bouts.first.loser2_name
|
||||
assert_equal "Winner Pool 2", @semi_bouts.second.loser1_name
|
||||
assert_equal "Runner Up Pool 1", @semi_bouts.second.loser2_name
|
||||
matches = @tournament.matches.where(weight_id: 2)
|
||||
semi_bouts = matches.where(bracket_position: 'Semis')
|
||||
assert_equal "Winner Pool 1", semi_bouts.first.loser1_name
|
||||
assert_equal "Runner Up Pool 2", semi_bouts.first.loser2_name
|
||||
assert_equal "Winner Pool 2", semi_bouts.second.loser1_name
|
||||
assert_equal "Runner Up Pool 1", semi_bouts.second.loser2_name
|
||||
end
|
||||
test 'test mat assignment after match generation' do
|
||||
@matches = @tournament.matches.order(:bout_number)
|
||||
assert_equal 'Mat1', @matches.first.mat.name
|
||||
matches = @tournament.matches.order(:bout_number)
|
||||
assert_equal 'Mat1', matches.first.mat.name
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user