diff --git a/lib/liquid/tags/include.rb b/lib/liquid/tags/include.rb index 08544672..2876a43d 100644 --- a/lib/liquid/tags/include.rb +++ b/lib/liquid/tags/include.rb @@ -73,7 +73,7 @@ module Liquid if cached = cached_partials[template_name] cached else - if @partial && context.registers[:file_system].nil? + if @partial partial = @partial else partial = Liquid::Template.parse(read_template_from_file_system(context), pass_options) @@ -85,7 +85,7 @@ module Liquid end def read_template_from_file_system(context) - file_system = context.registers[:file_system] || parsed_file_system || Liquid::Template.file_system + file_system = context.registers[:file_system] || Liquid::Template.file_system file_system.read_template_file(context[@template_name]) end diff --git a/test/integration/tags/include_tag_test.rb b/test/integration/tags/include_tag_test.rb index 56dd6185..57996c12 100644 --- a/test/integration/tags/include_tag_test.rb +++ b/test/integration/tags/include_tag_test.rb @@ -86,17 +86,12 @@ class IncludeTagTest < Minitest::Test def test_include_tag_can_use_file_system_at_parse_so_it_can_be_parsed_before_rendered assert_equal 'from ParseFileSystem', - Template.parse("{% include 'pick_a_source' %}",file_system: ParseFileSystem.new).render!({}) - end - - def test_include_tag_looks_at_file_system_passed_in_registers_over_parse_options - assert_equal 'from OtherFileSystem', Template.parse("{% include 'pick_a_source' %}",file_system: ParseFileSystem.new).render!({}, :registers => {:file_system => OtherFileSystem.new}) end - def test_include_tag_use_parse_option_file_system_even_if_partial_can_be_preparsed - assert_equal 'from ParseFileSystem', - Template.parse("{% include template %}",file_system: ParseFileSystem.new).render!({}) + def test_include_tag_use_registers_file_system_when_it_cant_be_preparse + assert_equal 'from OtherFileSystem', + Template.parse("{% include template %}",file_system: ParseFileSystem.new).render!({}, :registers => {:file_system => OtherFileSystem.new}) end def test_include_tag_with