mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
27 lines
924 B
Ruby
27 lines
924 B
Ruby
require 'test_helper'
|
|
|
|
class EightPoolToFourPoolChangesTest < ActionDispatch::IntegrationTest
|
|
def setup
|
|
@tournament = Tournament.find(4)
|
|
end
|
|
|
|
test "All wrestlers get matches after a weight switches from 8 pool to 4 pool" do
|
|
GenerateTournamentMatches.new(@tournament).generate
|
|
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 |