From 94e7b632c5210eb3195ba399ec52500c2fac325d Mon Sep 17 00:00:00 2001 From: Niall Burkley Date: Fri, 24 Mar 2017 12:01:15 +0100 Subject: [PATCH] Reorder I18n backends in `with_translations` helper The `with_translations` helper allows translations to be setup for a method under test. A recent change (#772) added a backend chain to ensure this helper won't break other spec by replacing all translations and causing "missing_translations" failures. This changes the order of the I18n backends so that specs will first use the translations provided to the `with_translations` block and then fallback to the default translations. Otherwise, there would be no way to override the default translations in test cases. --- spec/support/i18n.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/support/i18n.rb b/spec/support/i18n.rb index 69f2ad3bcd..dd1d6dc702 100644 --- a/spec/support/i18n.rb +++ b/spec/support/i18n.rb @@ -7,7 +7,7 @@ def with_translations(locale, translations) new_backend = I18n::Backend::KeyValue.new({}, true) new_backend.store_translations(locale, translations) - I18n.backend = I18n::Backend::Chain.new(original_backend, new_backend) + I18n.backend = I18n::Backend::Chain.new(new_backend, original_backend) yield ensure