1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-04 05:43:47 +00:00

rough cut of getting rid of the matches collection being passed around

Associated Weight and Match-- the FK already existed in the domain
Reduced argument counts on assignLoserNames and assignBouts; trying to pass a Tournament around more
This was a tough nut to crack.  Looking back, I tried to eat too much of the horse at once on this refactor.
This commit is contained in:
RJ Osborne
2015-05-26 15:09:48 -04:00
parent 20ef048f48
commit c041286943
6 changed files with 64 additions and 85 deletions

View File

@@ -3,7 +3,7 @@ require 'test_helper'
class PoolbracketMatchupsTest < ActionDispatch::IntegrationTest
def setup
@tournament = Tournament.find(1)
@genMatchups = @tournament.upcomingMatches
@genMatchups = @tournament.generateMatchups
end
def createTournament(numberOfWrestlers)
@@ -88,15 +88,15 @@ class PoolbracketMatchupsTest < ActionDispatch::IntegrationTest
assert_equal Weight::HS_WEIGHT_CLASSES.size, @tournament.weights.size
end
test "tests bout_number matches round" do
@matchup_to_test = @genMatchups.select{|m| m.bout_number == 4000}.first
assert_equal 4, @matchup_to_test.round
test "tests bout numbers correspond to round" do
matchup_to_test = @genMatchups.select{|m| m.bout_number == 4000}.first
assert_equal 4, matchup_to_test.round
end
test "tests bout_numbers are generated with smallest weight first regardless of id" do
@weight = @tournament.weights.order(:max).limit(1).first
@matchup = @genMatchups.select{|m| m.bout_number == 1000}.first
assert_equal @weight.max, @matchup.weight_max
weight = @tournament.weights.order(:max).limit(1).first
matchup = @tournament.matches.where(bout_number: 1000).limit(1).first
assert_equal weight.max, matchup.weight.max
end
test "tests number of matches in 5 man one pool" do