From e0d63c8aa90acd4608cfc34b2dbf2e34c6c7483f Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 17 Jan 2017 16:19:47 -0500 Subject: [PATCH] Add test to ensure that if the includes dir isn't in the theme that it won't break the site --- test/test_site.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/test_site.rb b/test/test_site.rb index bbf42d25..cee08dfd 100644 --- a/test/test_site.rb +++ b/test/test_site.rb @@ -49,6 +49,17 @@ class TestSite < JekyllUnitTest site = Site.new(site_configuration({ "baseurl" => "/blog" })) assert_equal "/blog", site.baseurl end + + should "only include theme includes_path if the path exists" do + site = fixture_site({ "theme" => "test-theme" }) + assert_equal [source_dir("_includes"), theme_dir("_includes")], site.includes_load_paths + + allow(File).to receive(:directory?).with(theme_dir("_sass")).and_return(true) + allow(File).to receive(:directory?).with(theme_dir("_layouts")).and_return(true) + allow(File).to receive(:directory?).with(theme_dir("_includes")).and_return(false) + site = fixture_site({ "theme" => "test-theme" }) + assert_equal [source_dir("_includes")], site.includes_load_paths + end end context "creating sites" do setup do