From 136dc32f303ca9df688857aeb25251a71962de21 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Doyle Date: Fri, 28 May 2021 16:17:20 -0400 Subject: [PATCH] Add fallback configuration now required https://github.com/ruby-i18n/i18n/pull/415 --- test/translates_test.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/translates_test.rb b/test/translates_test.rb index da8f1b2..f4f3f93 100644 --- a/test/translates_test.rb +++ b/test/translates_test.rb @@ -19,6 +19,7 @@ def test_retrieves_in_current_locale def test_retrieves_in_current_locale_with_fallbacks I18n::Backend::Simple.include(I18n::Backend::Fallbacks) I18n.default_locale = :"en-US" + I18n.fallbacks = [I18n.default_locale] p = Post.new(:title_translations => {"en" => "English Title"}) I18n.with_locale(:fr) do @@ -53,6 +54,7 @@ def test_retrieves_in_specified_locale def test_retrieves_in_specified_locale_with_fallbacks I18n::Backend::Simple.include(I18n::Backend::Fallbacks) I18n.default_locale = :"en-US" + I18n.fallbacks = [I18n.default_locale] p = Post.new(:title_translations => { "en" => "English Title" }) I18n.with_locale(:fr) do @@ -63,6 +65,7 @@ def test_retrieves_in_specified_locale_with_fallbacks def test_fallback_from_empty_string I18n::Backend::Simple.include(I18n::Backend::Fallbacks) I18n.default_locale = :"en-US" + I18n.fallbacks = [I18n.default_locale] p = Post.new(:title_translations => { "en" => "English Title", "fr" => "" }) I18n.with_locale(:fr) do @@ -73,17 +76,19 @@ def test_fallback_from_empty_string def test_retrieves_in_specified_locale_with_fallback_disabled I18n::Backend::Simple.include(I18n::Backend::Fallbacks) I18n.default_locale = :"en-US" + I18n.fallbacks = [I18n.default_locale] p = Post.new(:title_translations => { "en" => "English Title" }) p.disable_fallback I18n.with_locale(:fr) do - assert_equal(nil, p.title_fr) + assert_nil(p.title_fr) end end def test_retrieves_in_specified_locale_with_fallback_disabled_using_a_block I18n::Backend::Simple.include(I18n::Backend::Fallbacks) I18n.default_locale = :"en-US" + I18n.fallbacks = [I18n.default_locale] p = Post.new(:title_translations => { "en" => "English Title" }) p.enable_fallback @@ -95,6 +100,7 @@ def test_retrieves_in_specified_locale_with_fallback_disabled_using_a_block def test_retrieves_in_specified_locale_with_fallback_reenabled I18n::Backend::Simple.include(I18n::Backend::Fallbacks) I18n.default_locale = :"en-US" + I18n.fallbacks = [I18n.default_locale] p = Post.new(:title_translations => { "en" => "English Title" }) p.disable_fallback @@ -107,6 +113,7 @@ def test_retrieves_in_specified_locale_with_fallback_reenabled def test_retrieves_in_specified_locale_with_fallback_reenabled_using_a_block I18n::Backend::Simple.include(I18n::Backend::Fallbacks) I18n.default_locale = :"en-US" + I18n.fallbacks = [I18n.default_locale] p = Post.new(:title_translations => { "en" => "English Title" }) p.disable_fallback