diff --git a/spec/controllers/tournaments_controller_spec.rb b/spec/controllers/tournaments_controller_spec.rb index 3a64dde..da27ca7 100644 --- a/spec/controllers/tournaments_controller_spec.rb +++ b/spec/controllers/tournaments_controller_spec.rb @@ -233,6 +233,15 @@ RSpec.describe TournamentsController, type: :controller do expect(response).to have_http_status(:unprocessable_entity) end end + + context 'with empty team objects' do + it 'renders an unprocessable entity response' do + data = create_group_tournament_data + data[:teams] = [{ group: 1 }, { group: 1 }, { group: 2 }, { group: 2 }] + post :create, params: data + expect(response).to have_http_status(:unprocessable_entity) + end + end end end