DEV: Fix flaky test (#28163)

Before this commit, running `rspec --seed 22953 --format documentation spec/requests/admin/site_texts_controller_spec.rb:191 spec/lib/freedom_patches/translate_accelerator_spec.rb:109` will fail.

Setting `I18n.config.available_locales` is equivalent to hard coding the
locales for the entire process. It should not be set so that `I18n` will
fallback to `backend.locales`.
This commit is contained in:
Alan Guo Xiang Tan 2024-07-31 14:06:26 +08:00 committed by GitHub
parent a47bcfc2f3
commit f3ac2c9b5c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -211,8 +211,8 @@ RSpec.describe Admin::SiteTextsController do
get "/admin/customize/site_texts.json", params: params get "/admin/customize/site_texts.json", params: params
expect(response.status).to eq(200) expect(response.status).to eq(200)
expect(response.parsed_body["site_texts"].size).to eq(0) expect(response.parsed_body["site_texts"].size).to eq(0)
ensure
I18n.config.available_locales = available_locales I18n.config.available_locales = nil
end end
context "with plural keys" do context "with plural keys" do