Skip to content

Commit e4597b7

Browse files
committed
Make the #destroy method be a wrapper for #destroy_batch in SchoolStudentsController.
1 parent 8811c27 commit e4597b7

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

app/controllers/api/school_students_controller.rb

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,8 @@ def update
110110
end
111111

112112
def destroy
113-
result = SchoolStudent::Delete.call(school: @school, student_id: params[:id], token: current_user.token)
114-
115-
if result.success?
116-
head :no_content
117-
else
118-
render json: { error: result[:error] }, status: :unprocessable_entity
119-
end
113+
params[:student_ids] = [params[:id]]
114+
destroy_batch
120115
end
121116

122117
def destroy_batch

spec/features/school_student/deleting_a_school_student_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
expect(ProfileApiClient).not_to have_received(:create_safeguarding_flag).with(token: UserProfileMock::TOKEN, flag: ProfileApiClient::SAFEGUARDING_FLAGS[:teacher], email: owner.email)
2525
end
2626

27-
it 'responds 204 No Content' do
27+
it 'responds 200 OK' do
2828
delete("/api/schools/#{school.id}/students/#{student_id}", headers:)
29-
expect(response).to have_http_status(:no_content)
29+
expect(response).to have_http_status(:ok)
3030
end
3131

3232
it 'responds 401 Unauthorized when no token is given' do

0 commit comments

Comments
 (0)