DEV: clean up potential locale leak

DEV: clean up potential locale leak

This is an attempt to fix the flaky:

 1) Jobs::Onceoff can run all once off jobs without errors
     Failure/Error: self.locale_no_cache = value

     I18n::InvalidLocale:
       :bar is not a valid locale
     # ./lib/freedom_patches/translate_accelerator.rb:193:in `locale='
     # ./app/jobs/onceoff/clean_up_user_export_topics.rb:7:in `block in execute_onceoff'
     # ./app/jobs/onceoff/clean_up_user_export_topics.rb:6:in `map'
     # ./app/jobs/onceoff/clean_up_user_export_topics.rb:6:in `execute_onceoff'
     # ./spec/integrity/onceoff_integrity_spec.rb:13:in `block (3 levels) in <main>'
     # ./spec/integrity/onceoff_integrity_spec.rb:12:in `each'
     # ./spec/integrity/onceoff_integrity_spec.rb:12:in `block (2 levels) in <main>'
diff --git a/spec/models/locale_site_setting_spec.rb b/spec/models/locale_site_setting_spec.rb
index 1addea5..75fedf7 100644
--- a/spec/models/locale_site_setting_spec.rb
+++ b/spec/models/locale_site_setting_spec.rb
@@ -50,6 +50,7 @@ describe LocaleSiteSetting do
 
     after do
       DiscoursePluginRegistry.reset!
+      LocaleSiteSetting.reset!
     end
 
     describe '.valid_value?' do

GitHub sha: ba3bc6b2

3 Likes