mirror of
https://github.com/kemko/liquid.git
synced 2026-01-06 10:15:40 +03:00
Add locale to context registers
This commit is contained in:
@@ -30,4 +30,8 @@ class I18nTest < Test::Unit::TestCase
|
||||
@i18n.translate("doesnt_exist")
|
||||
end
|
||||
end
|
||||
|
||||
def test_sets_default_path_to_en
|
||||
assert_equal I18n::DEFAULT_LOCALE, I18n.new.path
|
||||
end
|
||||
end
|
||||
|
||||
@@ -143,4 +143,18 @@ class TemplateTest < Test::Unit::TestCase
|
||||
assert_equal 'bar', t.parse('{{bar}}').render(drop)
|
||||
assert_equal 'haha', t.parse("{{baz}}").render(drop)
|
||||
end
|
||||
end # TemplateTest
|
||||
|
||||
def test_sets_default_localization_in_context
|
||||
t = Template.new(:locale => fixture("en_locale.yml"))
|
||||
|
||||
assert_instance_of I18n, t.registers[:locale]
|
||||
assert_equal fixture("en_locale.yml"), t.registers[:locale].path
|
||||
end
|
||||
|
||||
def test_sets_default_localization_in_context_with_quick_initialization
|
||||
t = Template.parse('{{foo}}', :locale => fixture("en_locale.yml"))
|
||||
|
||||
assert_instance_of I18n, t.registers[:locale]
|
||||
assert_equal fixture("en_locale.yml"), t.registers[:locale].path
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user