diff options
author | José Valim <jose.valim@gmail.com> | 2010-05-23 13:22:19 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-05-23 13:22:19 +0200 |
commit | 8d5939c0966fa0255eae75e29f68ec55539206d1 (patch) | |
tree | 1708cfdf4768987a140734cddff1df8336317f57 /railties | |
parent | f3abc8ac36055afed9fcc902c33ee146e066d17a (diff) | |
download | rails-8d5939c0966fa0255eae75e29f68ec55539206d1.tar.gz rails-8d5939c0966fa0255eae75e29f68ec55539206d1.tar.bz2 rails-8d5939c0966fa0255eae75e29f68ec55539206d1.zip |
Fix a bug where I18n fallbacks modules where not included in the proper backend if it was set through config.i18n.backend.
Diffstat (limited to 'railties')
-rw-r--r-- | railties/test/railties/i18n_railtie_test.rb | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/railties/test/railties/i18n_railtie_test.rb b/railties/test/railties/i18n_railtie_test.rb index 51684aa838..2b1950b3d5 100644 --- a/railties/test/railties/i18n_railtie_test.rb +++ b/railties/test/railties/i18n_railtie_test.rb @@ -9,12 +9,6 @@ module RailtiesTest boot_rails FileUtils.rm_rf("#{app_path}/config/environments") require "rails/all" - @old_path = I18n.load_path - end - - def teardown - I18n.load_path = @old_path || [] - I18n.backend = nil end def load_app @@ -42,7 +36,7 @@ module RailtiesTest end test "not using config.i18n.fallbacks does not initialize I18n.fallbacks" do - I18n.backend = Class.new { include I18n::Backend::Base }.new # can't uninclude modules, so use a tmp backend class + I18n.backend = Class.new { include I18n::Backend::Base }.new load_app assert_no_fallbacks end @@ -50,6 +44,15 @@ module RailtiesTest test "config.i18n.fallbacks = true initializes I18n.fallbacks with default settings" do I18n::Railtie.config.i18n.fallbacks = true load_app + assert I18n.backend.class.included_modules.include?(I18n::Backend::Fallbacks) + assert_fallbacks :de => [:de, :en] + end + + test "config.i18n.fallbacks = true initializes I18n.fallbacks with default settings even when backend changes" do + I18n::Railtie.config.i18n.fallbacks = true + I18n::Railtie.config.i18n.backend = Class.new { include I18n::Backend::Base }.new + load_app + assert I18n.backend.class.included_modules.include?(I18n::Backend::Fallbacks) assert_fallbacks :de => [:de, :en] end |