Merge pull request #5652 from jekyll/pull/assert_nil
Merge pull request 5652
This commit is contained in:
commit
b6b0fdc05b
|
@ -206,7 +206,7 @@ class TestDocument < JekyllUnitTest
|
||||||
should "not know the specified front matter defaults" do
|
should "not know the specified front matter defaults" do
|
||||||
assert_equal "Example slide", @document.data["title"]
|
assert_equal "Example slide", @document.data["title"]
|
||||||
assert_equal "slide", @document.data["layout"]
|
assert_equal "slide", @document.data["layout"]
|
||||||
assert_equal nil, @document.data["nested"]
|
assert_nil @document.data["nested"]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -96,9 +96,13 @@ class TestPage < JekyllUnitTest
|
||||||
attrs.each do |attr, val|
|
attrs.each do |attr, val|
|
||||||
attr_str = attr.to_s
|
attr_str = attr.to_s
|
||||||
result = page[attr_str]
|
result = page[attr_str]
|
||||||
|
if val.nil?
|
||||||
|
assert_nil result, "For <page[\"#{attr_str}\"]>:"
|
||||||
|
else
|
||||||
assert_equal val, result, "For <page[\"#{attr_str}\"]>:"
|
assert_equal val, result, "For <page[\"#{attr_str}\"]>:"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "with pretty permalink style" do
|
context "with pretty permalink style" do
|
||||||
setup do
|
setup do
|
||||||
|
@ -220,7 +224,7 @@ class TestPage < JekyllUnitTest
|
||||||
|
|
||||||
should "return nil permalink if no permalink exists" do
|
should "return nil permalink if no permalink exists" do
|
||||||
@page = setup_page("")
|
@page = setup_page("")
|
||||||
assert_equal nil, @page.permalink
|
assert_nil @page.permalink
|
||||||
end
|
end
|
||||||
|
|
||||||
should "not be writable outside of destination" do
|
should "not be writable outside of destination" do
|
||||||
|
|
|
@ -57,7 +57,7 @@ class TestStaticFile < JekyllUnitTest
|
||||||
|
|
||||||
should "have a destination relative directory without a collection" do
|
should "have a destination relative directory without a collection" do
|
||||||
static_file = setup_static_file("root", "dir/subdir", "file.html")
|
static_file = setup_static_file("root", "dir/subdir", "file.html")
|
||||||
assert_equal nil, static_file.type
|
assert_nil static_file.type
|
||||||
assert_equal "dir/subdir/file.html", static_file.url
|
assert_equal "dir/subdir/file.html", static_file.url
|
||||||
assert_equal "dir/subdir", static_file.destination_rel_dir
|
assert_equal "dir/subdir", static_file.destination_rel_dir
|
||||||
end
|
end
|
||||||
|
|
|
@ -47,11 +47,11 @@ class TestTheme < JekyllUnitTest
|
||||||
end
|
end
|
||||||
|
|
||||||
should "not allow paths outside of the theme root" do
|
should "not allow paths outside of the theme root" do
|
||||||
assert_equal nil, @theme.send(:path_for, "../../source")
|
assert_nil @theme.send(:path_for, "../../source")
|
||||||
end
|
end
|
||||||
|
|
||||||
should "return nil for paths that don't exist" do
|
should "return nil for paths that don't exist" do
|
||||||
assert_equal nil, @theme.send(:path_for, "foo")
|
assert_nil @theme.send(:path_for, "foo")
|
||||||
end
|
end
|
||||||
|
|
||||||
should "return the resolved path when a symlink & resolved path exists" do
|
should "return the resolved path when a symlink & resolved path exists" do
|
||||||
|
|
Loading…
Reference in New Issue