Fix test flakes#86
Merged
mrcasals merged 2 commits intocodegram:masterfrom Feb 1, 2021
PlayerData:fix-test-flakes
Merged
Conversation
Otherwise, the custom translation may be overwritten when the backend loads translations as part of validation
Contributor
Author
|
Worth commenting that the I18n fix is only really an issue in the test suite. There are contrived cases where a user has used |
3 tasks
Contributor
|
Hi @ball-hayden! Thanks for taking the time and looking into it! Much appreciated! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
✍️ Description
The current test suite is order dependent. Specifically, the following test fails if it is not run in the correct order:
The cause of this seems to be related to lazy loading of translations by the I18n gem.
If
I18n.backend.store_translationsis called before the I18n backend has loaded translations, the "overridden" translation is lost and the default is returned instead. This would only be an issue for ActiveModel versions depending oni18n >= 1.6.0, which appears to have only been required since Rails 6.Also pulls in 4df9431 to fix issues if
Time.zonehasn't been required yet.✅ Fixes
This should fix the flakes currently blocking #85
✅ QA
Before requesting a review, please make sure that:
Documentation
I18n release notes for lazy/eager loading: https://github.com/ruby-i18n/i18n/releases/tag/v1.6.0