From ccd342bb51e33bae9daf2092d73c4eeb0f29cd40 Mon Sep 17 00:00:00 2001 From: voodoorai2000 Date: Wed, 10 Oct 2018 12:47:40 +0200 Subject: [PATCH] Fix flaky spec for translations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- spec/helpers/locales_helper_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/helpers/locales_helper_spec.rb b/spec/helpers/locales_helper_spec.rb index 2eb10be05..6031ae144 100644 --- a/spec/helpers/locales_helper_spec.rb +++ b/spec/helpers/locales_helper_spec.rb @@ -13,6 +13,7 @@ describe LocalesHelper do after do I18n.backend.reload! I18n.enforce_available_locales = default_enforce + I18n.backend.send(:init_translations) end it "returns the language name in i18n.language.name translation" do @@ -29,4 +30,4 @@ describe LocalesHelper do end end -end \ No newline at end of file +end