Add test to ensure that if the includes dir isn't in the theme that it won't break the site

This commit is contained in:
Parker Moore 2017-01-17 16:19:47 -05:00
parent ad8fb9b927
commit e0d63c8aa9
No known key found for this signature in database
GPG Key ID: 193CDEBA72063C58
1 changed files with 11 additions and 0 deletions

View File

@ -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