Use `assert_nil` instead of `assert_equal nil`

Fixes #5648
This commit is contained in:
Pat Hawks 2016-12-10 11:30:25 -06:00
parent b02f306f0a
commit 69c4a8a1aa
No known key found for this signature in database
GPG Key ID: F1746FF5F18B3D1B
4 changed files with 10 additions and 6 deletions

View File

@ -206,7 +206,7 @@ class TestDocument < JekyllUnitTest
should "not know the specified front matter defaults" do
assert_equal "Example slide", @document.data["title"]
assert_equal "slide", @document.data["layout"]
assert_equal nil, @document.data["nested"]
assert_nil @document.data["nested"]
end
end

View File

@ -96,7 +96,11 @@ class TestPage < JekyllUnitTest
attrs.each do |attr, val|
attr_str = attr.to_s
result = page[attr_str]
assert_equal val, result, "For <page[\"#{attr_str}\"]>:"
if val.nil?
assert_nil result, "For <page[\"#{attr_str}\"]>:"
else
assert_equal val, result, "For <page[\"#{attr_str}\"]>:"
end
end
end
@ -220,7 +224,7 @@ class TestPage < JekyllUnitTest
should "return nil permalink if no permalink exists" do
@page = setup_page("")
assert_equal nil, @page.permalink
assert_nil @page.permalink
end
should "not be writable outside of destination" do

View File

@ -57,7 +57,7 @@ class TestStaticFile < JekyllUnitTest
should "have a destination relative directory without a collection" do
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", static_file.destination_rel_dir
end

View File

@ -47,11 +47,11 @@ class TestTheme < JekyllUnitTest
end
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
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
should "return the resolved path when a symlink & resolved path exists" do