Test case for issue #5192, where Jekyll.sanitized_path strips drive name on Windows incorrectly

This commit is contained in:
Heng, K. (Stephen) 2016-08-26 11:43:32 +08:00
parent 0d8796fbe6
commit 23d7929948
1 changed files with 13 additions and 0 deletions

View File

@ -29,6 +29,19 @@ class TestPathSanitization < JekyllUnitTest
Jekyll.sanitized_path(source_dir, "f./../../../../../../files/hi.txt")
end
context "on Windows with absolute path" do
setup do
@base_path = "D:/demo"
@file_path = "D:/demo/_site"
allow(Dir).to receive(:pwd).and_return("D:/")
end
should "strip just the clean path drive name" do
assert_equal "D:/demo/_site",
Jekyll.sanitized_path(@base_path, @file_path)
end
end
context "on Windows with file path has matching prefix" do
setup do
@base_path = "D:/site"