add and use 'skip_if_windows' helper method

- add a new helper method to skip tests if on Windows platform
  - skip those tests that fail due to lack of support for symlinked files
    on Windows.
This commit is contained in:
Ashwin Maroli 2016-11-02 14:18:07 +05:30
parent e6b9dd1cc1
commit 1852e54d10
4 changed files with 19 additions and 0 deletions

View File

@ -158,4 +158,11 @@ class JekyllUnitTest < Minitest::Test
str
)
end
def skip_if_windows(msg = nil)
if Utils::Platforms.really_windows?
msg ||= "Jekyll does not currently support this feature on Windows."
skip msg.to_s.magenta
end
end
end

View File

@ -186,6 +186,9 @@ class TestCollections < JekyllUnitTest
end
should "include the symlinked file from site.source in the list of docs" do
# no support for including symlinked file on Windows
skip_if_windows "Jekyll does not currently support symlinks on Windows."
assert_includes @collection.docs.map(&:relative_path), "_methods/um_hi.md"
end
end

View File

@ -82,6 +82,9 @@ class TestEntryFilter < JekyllUnitTest
# rubocop:disable Performance/FixedSize
should "include only safe symlinks in safe mode" do
# no support for symlinks on Windows
skip_if_windows "Jekyll does not currently support symlinks on Windows."
site = Site.new(site_configuration("safe" => true))
site.reader.read_directories("symlink-test")
@ -91,6 +94,9 @@ class TestEntryFilter < JekyllUnitTest
# rubocop:enable Performance/FixedSize
should "include symlinks in unsafe mode" do
# no support for symlinks on Windows
skip_if_windows "Jekyll does not currently support symlinks on Windows."
site = Site.new(site_configuration)
site.reader.read_directories("symlink-test")

View File

@ -55,6 +55,9 @@ class TestTheme < JekyllUnitTest
end
should "return the resolved path when a symlink & resolved path exists" do
# no support for symlinks on Windows
skip_if_windows "Jekyll does not currently support symlinks on Windows."
expected = File.expand_path("./_layouts", @expected_root)
assert_equal expected, @theme.send(:path_for, :_symlink)
end