From 45be62391f8acdb38298bad49171257998dd4b27 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sat, 7 Oct 2023 11:44:38 +0100 Subject: [PATCH] Update test results for changes to rescuable exception handling https://github.com/rails/rails/pull/45867 --- .../api/changesets_controller_test.rb | 26 ++++++++++--------- .../diary_entries_controller_test.rb | 6 ++--- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/test/controllers/api/changesets_controller_test.rb b/test/controllers/api/changesets_controller_test.rb index b4bc4a5ab..802e006e1 100644 --- a/test/controllers/api/changesets_controller_test.rb +++ b/test/controllers/api/changesets_controller_test.rb @@ -134,12 +134,14 @@ module Api def test_create_wrong_method auth_header = basic_authorization_header create(:user).email, "test" - assert_raise ActionController::RoutingError do - get changeset_create_path, :headers => auth_header - end - assert_raise ActionController::RoutingError do - post changeset_create_path, :headers => auth_header - end + + get changeset_create_path, :headers => auth_header + assert_response :not_found + assert_template "rescues/routing_error" + + post changeset_create_path, :headers => auth_header + assert_response :not_found + assert_template "rescues/routing_error" end ## @@ -361,13 +363,13 @@ module Api auth_header = basic_authorization_header user.email, "test" - assert_raise ActionController::RoutingError do - get changeset_close_path(changeset), :headers => auth_header - end + get changeset_close_path(changeset), :headers => auth_header + assert_response :not_found + assert_template "rescues/routing_error" - assert_raise ActionController::RoutingError do - post changeset_close_path(changeset), :headers => auth_header - end + post changeset_close_path(changeset), :headers => auth_header + assert_response :not_found + assert_template "rescues/routing_error" end ## diff --git a/test/controllers/diary_entries_controller_test.rb b/test/controllers/diary_entries_controller_test.rb index c8aaf6409..b47446878 100644 --- a/test/controllers/diary_entries_controller_test.rb +++ b/test/controllers/diary_entries_controller_test.rb @@ -695,9 +695,9 @@ class DiaryEntriesControllerTest < ActionDispatch::IntegrationTest assert_template :show # Try a non-integer ID - assert_raise ActionController::RoutingError do - get "/user/#{CGI.escape(user.display_name)}/diary/#{diary_entry.id})" - end + get "/user/#{CGI.escape(user.display_name)}/diary/#{diary_entry.id})" + assert_response :not_found + assert_template "rescues/routing_error" # Try a deleted entry diary_entry_deleted = create(:diary_entry, :user => user, :visible => false) -- 2.39.5