1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00
Files
wrestlingdev.com/test/integration/eight_pool_to_four_pool_changes_test.rb

26 lines
875 B
Ruby

require 'test_helper'
class EightPoolToFourPoolChangesTest < ActionDispatch::IntegrationTest
def setup
create_pool_tournament_single_weight(24)
end
test "All wrestlers get matches after a weight switches from 8 pool to 4 pool" do
assert @tournament.matches.count == 36
assert @tournament.weights.first.pools == 8
count = 1
@tournament.reload.weights.first.wrestlers.sort_by{|wrestler| wrestler.pool}.each do |wrestler|
if count <= 8
wrestler.destroy
count = count + 1
end
end
GenerateTournamentMatches.new(@tournament.reload).generate
assert @tournament.matches.count == 32
assert @tournament.weights.first.pools == 4
@tournament.reload.weights.first.wrestlers.each do |wrestler|
assert wrestler.pool <= 4
assert wrestler.all_matches.count > 0
end
end
end