Permalink
Browse files

flatten load_path before using it so that a nested array of paths won…

…'t throw up
  • Loading branch information...
Sven Fuchs
Sven Fuchs committed Dec 29, 2008
1 parent dae5469 commit d473a068a2b90aba98135deb225d6eb6d8104d70
Showing with 13 additions and 1 deletion.
  1. +1 −1 lib/i18n/backend/simple.rb
  2. +12 −0 test/simple_backend_test.rb
@@ -76,7 +76,7 @@ def reload!
protected
def init_translations
- load_translations(*I18n.load_path)
+ load_translations(*I18n.load_path.flatten)
@initialized = true
end
@@ -472,6 +472,18 @@ def test_load_translations_loads_from_different_file_formats
end
end
+class I18nSimpleBackendLoadPathTest < Test::Unit::TestCase
+ include I18nSimpleBackendTestSetup
+
+ def test_nested_load_paths_do_not_break_locale_loading
+ @backend = I18n::Backend::Simple.new
+ I18n.load_path = [[File.dirname(__FILE__) + '/locale/en.yml']]
+ assert_nil backend_get_translations
+ assert_nothing_raised { @backend.send :init_translations }
+ assert_not_nil backend_get_translations
+ end
+end
+
class I18nSimpleBackendReloadTranslationsTest < Test::Unit::TestCase
include I18nSimpleBackendTestSetup

0 comments on commit d473a06

Please sign in to comment.