From: Tom Hughes Date: Tue, 8 Jul 2025 16:26:23 +0000 (+0100) Subject: Protect I18n.locale around test which changes it X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/HEAD?hp=-c Protect I18n.locale around test which changes it --- 33f74d5725bd9825c014b2394c8f20ad0ac2cfc4 diff --git a/test/controllers/notes_controller_test.rb b/test/controllers/notes_controller_test.rb index ca8be0470..8aea0cd39 100644 --- a/test/controllers/notes_controller_test.rb +++ b/test/controllers/notes_controller_test.rb @@ -93,11 +93,13 @@ class NotesControllerTest < ActionDispatch::IntegrationTest end def test_index_user_not_found_language - get user_notes_path("no_such_user"), :headers => { "Accept-Language" => "fr" } + I18n.with_locale "en" do + get user_notes_path("no_such_user"), :headers => { "Accept-Language" => "fr" } - assert_response :not_found - assert_dom "html" do - assert_dom "> @lang", "fr" + assert_response :not_found + assert_dom "html" do + assert_dom "> @lang", "fr" + end end end