Sha256: bf55452679eee3facb876559058b464d9993b9d2a3d21703332e02529b7492d1

Contents?: true

Size: 1.07 KB

Versions: 11

Compression:

Stored size: 1.07 KB

Contents

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

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
locomotivecms-liquid-4.0.0 test/unit/file_system_unit_test.rb
liquid-3.0.6 test/unit/file_system_unit_test.rb
liquid-3.0.5 test/unit/file_system_unit_test.rb
liquid-3.0.4 test/unit/file_system_unit_test.rb
liquid-3.0.3 test/unit/file_system_unit_test.rb
liquid-3.0.2 test/unit/file_system_unit_test.rb
locomotivecms-liquid-4.0.0.alpha2 test/unit/file_system_unit_test.rb
locomotivecms-liquid-4.0.0.alpha1 test/unit/file_system_unit_test.rb
locomotivecms-liquid-4.0.0.alpha test/unit/file_system_unit_test.rb
liquid-3.0.1 test/unit/file_system_unit_test.rb
liquid-3.0.0 test/unit/file_system_unit_test.rb