Skip to content

Commit

Permalink
Update Rack (#1249)
Browse files Browse the repository at this point in the history
* Update Rack and specs to fix dependabot PRs
* Update another failing spec following feedback form update
* Update name so it matches what is expected for a 422 status code
* Remove unprocessable content from errors controller
  • Loading branch information
martikat authored Jul 10, 2024
1 parent 0ad9e2a commit 276bc90
Show file tree
Hide file tree
Showing 20 changed files with 21 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ GEM
que (>= 0.14, < 3.0.0)
raabro (1.4.0)
racc (1.8.0)
rack (3.0.11)
rack (3.1.6)
rack-mini-profiler (3.3.1)
rack (>= 1.2.0)
rack-oauth2 (2.2.1)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/close_accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def update_reason
else
current_user.errors.clear
current_user.errors.add :closed_reason, :blank, message: 'Select a reason for closing your account'
render :edit_reason, status: :unprocessable_entity
render :edit_reason, status: :unprocessable_content
end
end

Expand Down
4 changes: 0 additions & 4 deletions app/controllers/errors_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ def not_found
render status: :not_found
end

def unprocessable_entity
render status: :unprocessable_entity
end

def internal_server_error
render status: :internal_server_error
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/feedback_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def update
track_feedback_start
redirect_to feedback_path(helpers.next_page.name)
else
render :show, status: :unprocessable_entity
render :show, status: :unprocessable_content
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def update
end
else
track('user_early_years_emails_change', success: false)
render :edit, status: :unprocessable_entity
render :edit, status: :unprocessable_content
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def update
end
else
track('user_early_years_experience_change', success: false)
render :edit, status: :unprocessable_entity
render :edit, status: :unprocessable_content
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def update
redirect_to next_form_path
else
track('user_local_authority_change', success: false)
render :edit, status: :unprocessable_entity
render :edit, status: :unprocessable_content
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/registration/names_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def update
end
else
track('user_name_change', success: false)
render :edit, status: :unprocessable_entity
render :edit, status: :unprocessable_content
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def update
redirect_to edit_registration_early_years_experience_path
else
track('user_role_type_other_change', success: false)
render :edit, status: :unprocessable_entity
render :edit, status: :unprocessable_content
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/registration/role_types_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def update
redirect_to edit_registration_early_years_experience_path
else
track('user_role_type_change', success: false)
render :edit, status: :unprocessable_entity
render :edit, status: :unprocessable_content
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def update
redirect_to edit_registration_local_authority_path
else
track('user_setting_type_other_change', success: false)
render :edit, status: :unprocessable_entity
render :edit, status: :unprocessable_content
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/registration/setting_types_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def update
end
else
track('user_setting_type_change', success: false)
render :edit, status: :unprocessable_entity
render :edit, status: :unprocessable_content
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def update
end
else
track('user_terms_and_conditions_agreed_at_change', success: false)
render :edit, status: :unprocessable_entity
render :edit, status: :unprocessable_content
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/registration/training_emails_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def update
end
else
track('user_training_emails_change', success: false)
render :edit, status: :unprocessable_entity
render :edit, status: :unprocessable_content
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/training/responses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def update
track_question_answer
redirect
else
render 'training/questions/show', status: :unprocessable_entity
render 'training/questions/show', status: :unprocessable_content
end
end

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/user_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def update_name
redirect_to user_path, notice: 'You have saved your details'
else
track('user_name_change', success: false)
render :edit_name, status: :unprocessable_entity
render :edit_name, status: :unprocessable_content
end
end

Expand All @@ -29,7 +29,7 @@ def update_training_emails
redirect_to user_path, notice: 'Your email preferences have been saved.'
else
track('user_training_emails_change', success: false)
render :edit_training_emails, status: :unprocessable_entity
render :edit_training_emails, status: :unprocessable_content
end
end

Expand Down
2 changes: 1 addition & 1 deletion config/initializers/devise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,6 @@
# changed. Defaults to true, so a user is signed in automatically after changing a password.
# config.sign_in_after_change_password = true

config.responder.error_status = :unprocessable_entity
config.responder.error_status = :unprocessable_content
config.responder.redirect_status = :see_other
end
2 changes: 1 addition & 1 deletion spec/controllers/feedback_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@

it 'is not processed' do
post :update, params: params
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end

it 'is not persisted' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

it 'fails with unknown input' do
post :update, params: { user: { setting_type_id: 'unknown' } }
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/training/responses_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
context 'and no answer' do
let(:answers) { nil }

specify { expect(response).to have_http_status(:unprocessable_entity) }
specify { expect(response).to have_http_status(:unprocessable_content) }
specify { expect(records).to be 0 }
end
end
Expand All @@ -62,7 +62,7 @@
context 'and no answers' do
let(:answers) { nil }

specify { expect(response).to have_http_status(:unprocessable_entity) }
specify { expect(response).to have_http_status(:unprocessable_content) }
specify { expect(records).to be 0 }
end
end
Expand Down

0 comments on commit 276bc90

Please sign in to comment.