Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
flatten load_path before using it so that a nested array of paths won…
…'t throw up
  • Loading branch information
Sven Fuchs committed Dec 29, 2008
1 parent dae5469 commit d473a06
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/i18n/backend/simple.rb
Expand Up @@ -76,7 +76,7 @@ def reload!

protected
def init_translations
load_translations(*I18n.load_path)
load_translations(*I18n.load_path.flatten)
@initialized = true
end

Expand Down
12 changes: 12 additions & 0 deletions test/simple_backend_test.rb
Expand Up @@ -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

Expand Down

0 comments on commit d473a06

Please sign in to comment.