Ensure the new type works.

This commit is contained in:
Parker Moore 2014-08-12 12:24:28 -04:00
parent 2fd155615f
commit 90ec93373b
1 changed files with 26 additions and 1 deletions

View File

@ -53,7 +53,7 @@ class TestFrontMatterDefaults < Test::Unit::TestCase
end
end
context "A site with front matter defaults with no path" do
context "A site with front matter defaults with no path and a deprecated type" do
setup do
@site = Site.new(Jekyll.configuration({
"source" => source_dir,
@ -78,6 +78,31 @@ class TestFrontMatterDefaults < Test::Unit::TestCase
end
end
context "A site with front matter defaults with no path" do
setup do
@site = Site.new(Jekyll.configuration({
"source" => source_dir,
"destination" => dest_dir,
"defaults" => [{
"scope" => {
"type" => "pages"
},
"values" => {
"key" => "val"
}
}]
}))
@site.process
@affected = @site.pages
@not_affected = @site.posts
end
should "affect only the specified type and all paths" do
assert_equal @affected.reject { |page| page.data["key"] == "val" }, []
assert_equal @not_affected.reject { |page| page.data["key"] == "val" }, @not_affected
end
end
context "A site with front matter defaults with no path or type" do
setup do
@site = Site.new(Jekyll.configuration({