Sha256: 9909a42c076ca9af6b939437734c8838b3bd768865caf5187c871d1cd082e056

Contents?: true

Size: 815 Bytes

Versions: 3

Compression:

Stored size: 815 Bytes

Contents

#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/helper'

class FileSystemTest < Test::Unit::TestCase
  include Liquid
  
  def test_default
    assert_raise(FileSystemError) do
      BlankFileSystem.new.read_template_file("dummy")
    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_raise(FileSystemError) do
      file_system.full_path("../dir/mypartial")
    end

    assert_raise(FileSystemError) do
      file_system.full_path("/dir/../../dir/mypartial")      
    end

    assert_raise(FileSystemError) do
      file_system.full_path("/etc/passwd")
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
drnic-liquid-2.1.0 test/file_system_test.rb
liquid-1.7.0 test/file_system_test.rb
liquid-1.9.0 test/file_system_test.rb