now able to set file_system for include tag through registers

This commit is contained in:
James MacAulay
2009-08-06 18:24:27 -04:00
parent 7ff4352de2
commit a4d7c80ce0
2 changed files with 16 additions and 1 deletions
+14
View File
@@ -23,6 +23,9 @@ class TestFileSystem
when "recursively_nested_template"
"-{% include 'recursively_nested_template' %}"
when "pick_a_source"
"from TestFileSystem"
else
template_path
@@ -30,6 +33,12 @@ class TestFileSystem
end
end
class OtherFileSystem
def read_template_file(template_path)
'from OtherFileSystem'
end
end
class IncludeTagTest < Test::Unit::TestCase
include Liquid
@@ -37,6 +46,11 @@ class IncludeTagTest < Test::Unit::TestCase
Liquid::Template.file_system = TestFileSystem.new
end
def test_include_tag_looks_for_file_system_in_registers_first
assert_equal 'from OtherFileSystem',
Template.parse("{% include 'pick_a_source' %}").render({}, :registers => {:file_system => OtherFileSystem.new})
end
def test_include_tag_with
assert_equal "Product: Draft 151cm ",