From 1852e54d102f3877ebad04134db3296178458a74 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Wed, 2 Nov 2016 14:18:07 +0530 Subject: [PATCH] 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. --- test/helper.rb | 7 +++++++ test/test_collections.rb | 3 +++ test/test_entry_filter.rb | 6 ++++++ test/test_theme.rb | 3 +++ 4 files changed, 19 insertions(+) diff --git a/test/helper.rb b/test/helper.rb index 8fc43d67..ad88b5d0 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -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 diff --git a/test/test_collections.rb b/test/test_collections.rb index 3ae1ab12..45e2a511 100644 --- a/test/test_collections.rb +++ b/test/test_collections.rb @@ -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 diff --git a/test/test_entry_filter.rb b/test/test_entry_filter.rb index eed24567..f65badc6 100644 --- a/test/test_entry_filter.rb +++ b/test/test_entry_filter.rb @@ -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") diff --git a/test/test_theme.rb b/test/test_theme.rb index fd380d95..918d01f6 100644 --- a/test/test_theme.rb +++ b/test/test_theme.rb @@ -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