Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
References
Objectives
Fix the flaky specs that appeared in
spec/features/localization_spec.rb:34
("Localization Changing the locale") andspec/features/localization_spec.rb:20
("Localization Available locales appear in the locale switcher").Explain why the test is flaky, or under which conditions/scenario it fails randomly
These specs fail when executed after
spec/customization_engine_spec.rb:19
andspec/features/localization_spec.rb:44
, causing the following sequence:I18n.reload!
, which causesI18n.config.backend
to set@translations = nil
.available_locales
to[:en]
, causing@translations
to get only translations for:en
.@translations
only has the English ones, and fails.Explain why your PR fixes it
Reloading
I18n
after the test stubbingavailable_locales
solves the problem, since it sets@translations = nil
again, and so it fetches translations for Spanish (and all the other languages).Notes
init_translations
, sincei18n
doesn't automatically init translations