mirror of
https://github.com/kemko/liquid.git
synced 2026-01-03 16:55:40 +03:00
Ruby 1.9+ uses Minitest as the backend for Test::Unit. As of Minitest 5, the shim has broken some compatibility with Test::Unit::TestCase in some scenarios. Adjusts the test suite to support Minitest 5's syntax. Minitest versions 4 and below do not support the newer Minitest::Test class that arrived in version 5. For that case, use the MiniTest::Unit::TestCase class as a fallback Conflicts: test/integration/tags/for_tag_test.rb test/test_helper.rb
36 lines
1.1 KiB
Ruby
36 lines
1.1 KiB
Ruby
require 'test_helper'
|
|
|
|
class FileSystemUnitTest < Minitest::Test
|
|
include Liquid
|
|
|
|
def test_default
|
|
assert_raises(FileSystemError) do
|
|
BlankFileSystem.new.read_template_file("dummy", {'dummy'=>'smarty'})
|
|
end
|
|
end
|
|
|
|
def test_local
|
|
file_system = Liquid::LocalFileSystem.new("/some/path")
|
|
assert_equal "/some/path/_mypartial.liquid" , file_system.full_path("mypartial")
|
|
assert_equal "/some/path/dir/_mypartial.liquid", file_system.full_path("dir/mypartial")
|
|
|
|
assert_raises(FileSystemError) do
|
|
file_system.full_path("../dir/mypartial")
|
|
end
|
|
|
|
assert_raises(FileSystemError) do
|
|
file_system.full_path("/dir/../../dir/mypartial")
|
|
end
|
|
|
|
assert_raises(FileSystemError) do
|
|
file_system.full_path("/etc/passwd")
|
|
end
|
|
end
|
|
|
|
def test_custom_template_filename_patterns
|
|
file_system = Liquid::LocalFileSystem.new("/some/path", "%s.html")
|
|
assert_equal "/some/path/mypartial.html" , file_system.full_path("mypartial")
|
|
assert_equal "/some/path/dir/mypartial.html", file_system.full_path("dir/mypartial")
|
|
end
|
|
end # FileSystemTest
|