mirror of
https://github.com/discourse/discourse.git
synced 2025-08-17 18:04:11 +08:00
DEV: adds unregister_locale (#32676)
Running this spec locally I was getting an error: ``` 1) translate accelerator plugins loads plural rules from plugins Failure/Error: DiscoursePluginRegistry.unregister_locale("foo") NoMethodError: undefined method `unregister_locale' for class DiscoursePluginRegistry # ./spec/lib/freedom_patches/translate_accelerator_spec.rb:113:in `block (3 levels) in <main>' Finished in 0.17998 seconds (files took 1.88 seconds to load) 1 example, 1 failure Failed examples: rspec ./spec/lib/freedom_patches/translate_accelerator_spec.rb:117 # translate accelerator plugins loads plural rules from plugins ``` On top of this, this spec was flakey, Im not sure this is going to fix flakyness, but this seems like a good first step.
This commit is contained in:
parent
7f2233b1d3
commit
da111d87bd
2 changed files with 7 additions and 1 deletions
|
@ -168,6 +168,12 @@ class DiscoursePluginRegistry
|
|||
self.locales[locale] = options
|
||||
end
|
||||
|
||||
def self.unregister_locale(locale)
|
||||
raise "unregister_locale can only be used in tests" if !Rails.env.test?
|
||||
|
||||
self.locales.delete(locale)
|
||||
end
|
||||
|
||||
def register_archetype(name, options = {})
|
||||
Archetype.register(name, options)
|
||||
end
|
||||
|
|
|
@ -110,7 +110,7 @@ RSpec.describe "translate accelerator" do
|
|||
end
|
||||
|
||||
after do
|
||||
DiscoursePluginRegistry.reset!
|
||||
DiscoursePluginRegistry.unregister_locale("foo")
|
||||
LocaleSiteSetting.reset!
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue