Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flaky spec for translations #2962

Merged
merged 1 commit into from
Oct 17, 2018
Merged

Fix flaky spec for translations #2962

merged 1 commit into from
Oct 17, 2018

Conversation

voodoorai2000
Copy link
Member

References

Objectives

Fix the flaky spec that appeared in spec/features/localization_spec.rb:20 ("Available locales appear in the locale switcher").

How to reproduce

From the master branch:
bin/rspec spec/features/localization_spec.rb spec/helpers/locales_helper_spec.rb --seed 12144

Explain why the test is flaky

I think it was because no translation had been called yet, in the old spec, and so the the i18n backend translations had not been initialized, and was always returning empty translations for any locale.

This might have been due to tampering with translations in the new spec

Explain why your PR fixes it

By forcing translations to load after this new spec, the other spec passes again

This spec was causing a side effect on another spec[2], making it fail 😌

I think it was because no translation had been called yet, in the failing spec, and so the the i18n backend translations had not been initialized, and was always returning empty translations for any locale. This might have been due to tampering with translations in the this newly introduced spec.

By forcing translations to load after this new spec, the other spec passes again

[2] https://github.com/AyuntamientoMadrid/consul/blob/master/spec/features/localization_spec.rb#L20
@voodoorai2000 voodoorai2000 self-assigned this Oct 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants