Skip Windows tests in non-Windows environment.

This commit is contained in:
Heng Kwokfu 2016-09-24 21:55:02 +08:00
parent db53213d16
commit bacb300876
1 changed files with 22 additions and 20 deletions

View File

@ -29,29 +29,31 @@ 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:/")
if Jekyll::Utils::Platforms.really_windows?
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
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"
@file_path = "D:/sitemap.xml"
allow(Dir).to receive(:pwd).and_return("D:/")
end
context "on Windows with file path has matching prefix" do
setup do
@base_path = "D:/site"
@file_path = "D:/sitemap.xml"
allow(Dir).to receive(:pwd).and_return("D:/")
end
should "not strip base path" do
assert_equal "D:/site/sitemap.xml",
Jekyll.sanitized_path(@base_path, @file_path)
should "not strip base path" do
assert_equal "D:/site/sitemap.xml",
Jekyll.sanitized_path(@base_path, @file_path)
end
end
end