Add locale to context registers

This commit is contained in:
Simon Eskildsen
2013-08-30 12:31:57 -04:00
parent 0a2f21386d
commit 40fba9ee6c
4 changed files with 29 additions and 17 deletions
+15 -1
View File
@@ -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