DEV: Fix another flaky spec

The error was:

```
  1) ExtraLocalesController.client_overrides_exist? returns true if there are client-side translation overrides
     Failure/Error: expect(ExtraLocalesController.client_overrides_exist?).to eq(false)

       expected: false
            got: true

       (compared using ==)

       Diff:
       @@ -1 +1 @@
       -false
       +true

     # ./spec/requests/extra_locales_controller_spec.rb:162:in `block (3 levels) in <main>'
     # ./spec/rails_helper.rb:279:in `block (2 levels) in <top (required)>'
     # .gem/ruby/2.7.3/gems/webmock-3.13.0/lib/webmock/rspec.rb:37:in `block (2 levels) in <top (required)>'
```

Minimal repro:

```
bin/rspec './spec/models/trust_level_and_staff_setting_spec.rb[1:1:1]' './spec/requests/extra_locales_controller_spec.rb[1:3:2]' --tag ~type:multisite --seed 33616
```
This commit is contained in:
Jarek Radosz 2021-06-08 03:44:46 +02:00 committed by Alan Guo Xiang Tan
parent 45971d8c3c
commit 0fe9a36e89
1 changed files with 4 additions and 0 deletions

View File

@ -4,6 +4,10 @@ require 'rails_helper'
describe TrustLevelAndStaffSetting do describe TrustLevelAndStaffSetting do
describe ".values" do describe ".values" do
after do
I18n.reload!
end
it "returns translated names" do it "returns translated names" do
TranslationOverride.upsert!(I18n.locale, "js.trust_levels.names.newuser", "New Member") TranslationOverride.upsert!(I18n.locale, "js.trust_levels.names.newuser", "New Member")
TranslationOverride.upsert!(I18n.locale, "trust_levels.admin", "Hero") TranslationOverride.upsert!(I18n.locale, "trust_levels.admin", "Hero")