From 1bbd6b58fdaa430b6b944364db20700b0848b58b Mon Sep 17 00:00:00 2001 From: David Cook Date: Thu, 13 Mar 2025 11:56:16 +1100 Subject: [PATCH 1/2] Run tests with specified locale We changed .env.test a while ago, but I just discovered it hadn't taken any effect because it was overwritten here. Now it's loaded from env var. --- spec/base_spec_helper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/base_spec_helper.rb b/spec/base_spec_helper.rb index f8c30b3f07..7f7ef01a12 100644 --- a/spec/base_spec_helper.rb +++ b/spec/base_spec_helper.rb @@ -150,7 +150,8 @@ RSpec.configure do |config| # Reset locale for all specs. config.around(:each) do |example| - I18n.with_locale(:en_AU) { example.run } + locale = ENV.fetch('LOCALE', 'en_TST') + I18n.with_locale(locale) { example.run } end # Reset all feature toggles to prevent leaking. From c882924a60287e2778bbaf2f57fcda9fa24f8ca3 Mon Sep 17 00:00:00 2001 From: David Cook Date: Mon, 17 Mar 2025 13:52:46 +1100 Subject: [PATCH 2/2] Add comment to .env.test [skip ci] --- .env.test | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.env.test b/.env.test index 4cd76d6f0a..6d4d943414 100644 --- a/.env.test +++ b/.env.test @@ -1,7 +1,8 @@ # ENV vars for the test environment # Override locally with `.env.test.local` -# Locale for translation. +# Locale for translation. Using a locale other than `en` tests the +# successful fallback to `en`. LOCALE="en_TST" OFN_REDIS_JOBS_URL="redis://localhost:6379/2"