Fix teams not associated with created tournament
when choosing a group stage
This commit is contained in:
parent
f71179ee8a
commit
3109308817
|
|
@ -39,6 +39,8 @@ class TournamentsController < ApplicationController
|
|||
if group_stage
|
||||
params.require(:playoff_teams_amount)
|
||||
groups = organize_teams_in_groups(teams)
|
||||
# associate provided teams with tournament
|
||||
tournament.teams = groups.flatten
|
||||
# add groups to tournament
|
||||
result = AddGroupStageToTournamentAndSave.call(tournament: tournament, groups: groups)
|
||||
else
|
||||
|
|
|
|||
|
|
@ -195,6 +195,10 @@ RSpec.describe TournamentsController, type: :controller do
|
|||
.to eq(create_group_tournament_data[:playoff_teams_amount])
|
||||
end
|
||||
|
||||
it 'associates the given teams with the created tournament' do
|
||||
expect(@group_stage_tournament.teams).to match_array(@teams16)
|
||||
end
|
||||
|
||||
context 'playoff_teams_amount unacceptable' do
|
||||
shared_examples_for 'wrong playoff_teams_amount' do
|
||||
it 'fails' do
|
||||
|
|
|
|||
Loading…
Reference in New Issue