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") Jekyll.sanitized_path(source_dir, "f./../../../../../../files/hi.txt")
end end
context "on Windows with absolute path" do if Jekyll::Utils::Platforms.really_windows?
setup do context "on Windows with absolute path" do
@base_path = "D:/demo" setup do
@file_path = "D:/demo/_site" @base_path = "D:/demo"
allow(Dir).to receive(:pwd).and_return("D:/") @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 end
should "strip just the clean path drive name" do context "on Windows with file path has matching prefix" do
assert_equal "D:/demo/_site", setup do
Jekyll.sanitized_path(@base_path, @file_path) @base_path = "D:/site"
end @file_path = "D:/sitemap.xml"
end allow(Dir).to receive(:pwd).and_return("D:/")
end
context "on Windows with file path has matching prefix" do should "not strip base path" do
setup do assert_equal "D:/site/sitemap.xml",
@base_path = "D:/site" Jekyll.sanitized_path(@base_path, @file_path)
@file_path = "D:/sitemap.xml" end
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)
end end
end end