Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ GEM
rubocop-rspec (3.6.0)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
rubocop-rspec_rails (2.31.0)
rubocop-rspec_rails (2.32.0)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
rubocop-rspec (~> 3.5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@

it 'responds 422 Unprocessable Entity' do
post("/api/schools/#{school.id}/classes/#{school_class.id}/members/batch", headers:, params: invalid_params)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'returns the error message in the operation response' do
Expand Down
6 changes: 3 additions & 3 deletions spec/features/class_member/creating_a_class_member_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

it 'responds 422 Unprocessable Entity' do
post("/api/schools/#{school.id}/classes/#{school_class.id}/members", headers:, params: student_params)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'returns the error message from the operation response' do
Expand Down Expand Up @@ -132,7 +132,7 @@

it 'responds 422 Unprocessable Entity' do
post("/api/schools/#{school.id}/classes/#{school_class.id}/members", headers:, params: teacher_params)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'returns the error message from the operation response' do
Expand Down Expand Up @@ -209,7 +209,7 @@

it 'responds 422 Unprocessable Entity when params are invalid' do
post("/api/schools/#{school.id}/classes/#{school_class.id}/members", headers:, params: invalid_params)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'returns the error message in the operation response' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/feedback/creating_feedback_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
end

it 'returns unprocessable entity response' do
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'does not add the feedback to the school project' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/lesson/creating_a_copy_of_a_lesson_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

it 'responds 422 Unprocessable Entity when params are invalid' do
post("/api/lessons/#{lesson.id}/copy", headers:, params: { lesson: { name: ' ' } })
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'responds 401 Unauthorized when no token is given' do
Expand Down
8 changes: 4 additions & 4 deletions spec/features/lesson/creating_a_lesson_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

it 'responds 422 Unprocessable Entity when params are invalid' do
post('/api/lessons', headers:, params: { lesson: { name: ' ' } })
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'responds 401 Unauthorized when no token is given' do
Expand Down Expand Up @@ -151,14 +151,14 @@
new_params = { lesson: params[:lesson].without(:school_id) }

post('/api/lessons', headers:, params: new_params)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'responds 422 Unprocessable if school_class_id does not correspond to school_id' do
new_params = { lesson: params[:lesson].merge(school_id: SecureRandom.uuid) }

post('/api/lessons', headers:, params: new_params)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'responds 403 Forbidden when the user is a school-owner for a different school' do
Expand All @@ -183,7 +183,7 @@
new_params = { lesson: params[:lesson].merge(user_id:) }

post('/api/lessons', headers:, params: new_params)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end
end
end
4 changes: 2 additions & 2 deletions spec/features/lesson/updating_a_lesson_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

it 'responds 422 Unprocessable Entity when params are invalid' do
put("/api/lessons/#{lesson.id}", headers:, params: { lesson: { name: ' ' } })
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'responds 401 Unauthorized when no token is given' do
Expand Down Expand Up @@ -125,7 +125,7 @@
new_params = { lesson: params[:lesson].merge(school_class_id: school_class.id) }
put("/api/lessons/#{lesson.id}", headers:, params: new_params)

expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end
end
end
8 changes: 4 additions & 4 deletions spec/features/project/creating_a_project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

it 'responds 422 Unprocessable Entity when params are invalid' do
post('/api/projects', headers:, params: { project: { components: [{ name: ' ' }] } })
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'responds 401 Unauthorized when no token is given' do
Expand Down Expand Up @@ -168,21 +168,21 @@
new_params = { project: project.merge(user_id:) }

post('/api/projects', headers:, params: new_params)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'responds 422 Unprocessable when lesson_id is provided but school_id is missing' do
new_params = { project: params[:project].without(:school_id) }

post('/api/projects', headers:, params: new_params)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'responds 422 Unprocessable when lesson_id does not correspond to school_id' do
new_params = { project: params[:project].merge(lesson_id: SecureRandom.uuid) }

post('/api/projects', headers:, params: new_params)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'responds 403 Forbidden when the user is a school-owner for a different school' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/project/updating_a_project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

it 'responds 422 Unprocessable Entity when params are invalid' do
put("/api/projects/#{project.id}", headers:, params: { project: { components: [{ name: ' ' }] } })
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'responds 401 Unauthorized when no token is given' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/school/creating_a_school_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

it 'responds 422 Unprocessable Entity when params are invalid' do
post('/api/schools', headers:, params: { school: { name: ' ' } })
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'responds 401 Unauthorized when no token is given' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/school/importing_schools_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
it 'responds 422 Unprocessable Entity' do
post('/api/schools/import', headers:)

expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
data = JSON.parse(response.body, symbolize_names: true)
expect(data[:error][:error_code]).to eq('CSV_FILE_REQUIRED')
end
Expand Down
2 changes: 1 addition & 1 deletion spec/features/school/updating_a_school_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

it 'responds 422 Unprocessable Entity when params are invalid' do
put("/api/schools/#{school.id}", headers:, params: { school: { name: ' ' } })
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'responds 401 Unauthorized when no token is given' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/school_class/creating_a_school_class_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

it 'responds 422 Unprocessable Entity when params are invalid' do
post("/api/schools/#{school.id}/classes", headers:, params: { school_class: { name: ' ' } })
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'responds 401 Unauthorized when no token is given' do
Expand Down
10 changes: 5 additions & 5 deletions spec/features/school_class/importing_a_school_class_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

post(import_url, headers:, params: params_missing_origin)

expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
error_response = JSON.parse(response.body)
expect(error_response).to have_key('error')
expect(error_response['error']).to include("Import origin can't be blank")
Expand All @@ -52,7 +52,7 @@

post(import_url, headers:, params: params_missing_id)

expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
error_response = JSON.parse(response.body)
expect(error_response).to have_key('error')
expect(error_response['error']).to include("Import id can't be blank")
Expand All @@ -65,7 +65,7 @@

post(import_url, headers:, params: params_missing_both)

expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
error_response = JSON.parse(response.body)
expect(error_response).to have_key('error')
expect(error_response['error']).to include("Import origin can't be blank")
Expand All @@ -77,7 +77,7 @@

post(import_url, headers:, params: params_invalid_enum)

expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
error_response = JSON.parse(response.body)
expect(error_response).to have_key('error')
expect(error_response['error']).to include('Import origin is not included in the list')
Expand All @@ -89,7 +89,7 @@

post(import_url, headers:, params: params_missing_name)

expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
error_response = JSON.parse(response.body)
expect(error_response).to have_key('error')
expect(error_response['error']).to include("Name can't be blank")
Expand Down
2 changes: 1 addition & 1 deletion spec/features/school_class/updating_a_school_class_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

it 'responds 422 Unprocessable Entity when params are invalid' do
put("/api/schools/#{school.id}/classes/#{school_class.id}", headers:, params: { school_class: { name: ' ' } })
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'responds 401 Unauthorized when no token is given' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/school_project/complete_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
end

it 'completes unauthorized response' do
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'completes error message' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/school_project/return_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
end

it 'returns unauthorized response' do
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'returns error message' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/school_project/submit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
end

it 'returns unauthorized response' do
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'returns error message' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/school_project/unsubmit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
end

it 'returns unauthorized response' do
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'returns error message' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
delete "/api/schools/#{school.id}/students/batch",
headers: headers

expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
json = JSON.parse(response.body)
expect(json['error']).to eq('No student IDs provided')
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
expect do
post("/api/schools/#{school.id}/students/batch", headers:, params:)
end.not_to change(GoodJob::BatchRecord, :count)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)

active_batches = GoodJob::BatchRecord.where(
description: school.id,
Expand Down Expand Up @@ -126,20 +126,20 @@

it 'responds 422 Unprocessable Entity when params are invalid' do
post("/api/schools/#{school.id}/students/batch", headers:, params: { school_students: [] })
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'responds 422 Unprocessable Entity with a suitable message when params are invalid' do
post("/api/schools/#{school.id}/students/batch", headers:, params: bad_params)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
expect(response.body).to include('Decryption failed: iv must be 16 bytes')
end

it 'responds 422 Unprocessable Entity with a JSON array of validation errors' do
stub_profile_api_create_school_students_validation_error
stub_profile_api_validate_students_with_validation_error
post("/api/schools/#{school.id}/students/batch", headers:, params:)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
expect(response.body).to eq(
{
error: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

it 'responds 422 Unprocessable Entity when params are invalid' do
post("/api/schools/#{school.id}/students", headers:, params: { school_student: { username: ' ' } })
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'responds 401 Unauthorized when no token is given' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

it 'responds 422 Unprocessable Entity when params are invalid' do
post("/api/schools/#{school.id}/teachers", headers:, params: { school_teacher: { email_address: 'invalid' } })
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'responds 401 Unauthorized when no token is given' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
it 'responds 422 Unprocessable entity' do
put("/api/teacher_invitations/#{token}/accept", headers:)

expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'does not give the user the teacher role for the school to which they have been invited' do
Expand Down Expand Up @@ -108,7 +108,7 @@
it 'responds 422 Unprocessable entity' do
put("/api/teacher_invitations/#{token}/accept", headers:)

expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'does not give the user the teacher role for the school to which they have been invited' do
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/api_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def index
it 'responds with 422 Unprocessable entity status code' do
get '/test'

expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'responds with JSON including exception class & message' do
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/projects/create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
it 'returns error' do
post('/api/projects', headers:)

expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end
end
end
Expand Down
Loading