test/webgen/test_tree.rb in webgen-1.4.0 vs test/webgen/test_tree.rb in webgen-1.4.1
- old
+ new
@@ -11,11 +11,11 @@
setup_website
@tree = @website.tree
end
def test_initialize
- refute_equal(nil, @tree.dummy_root)
+ refute_nil(@tree.dummy_root)
assert_equal('', @tree.dummy_root.alcn)
end
def test_root
root = Webgen::Node.new(@tree.dummy_root, '/', '/')
@@ -27,20 +27,20 @@
setup_default_nodes(@tree)
assert_equal(@tree['/file.de.html'], @tree.translate_node(@tree['/file.en.html'], 'de'))
assert_equal(@tree['/file.en.html'], @tree.translate_node(@tree['/file.en.html'], 'en'))
assert_equal(@tree['/file.en.html'], @tree.translate_node(@tree['/file.de.html'], 'en'))
- assert_equal(nil, @tree.translate_node(@tree['/file.de.html'], 'fr'))
- assert_equal(nil, @tree.translate_node(@tree['/file.en.html'], nil))
+ assert_nil(@tree.translate_node(@tree['/file.de.html'], 'fr'))
+ assert_nil(@tree.translate_node(@tree['/file.en.html'], nil))
assert_equal(@tree['/other.en.html'], @tree.translate_node(@tree['/other.html'], 'en'))
assert_equal(@tree['/other.html'], @tree.translate_node(@tree['/other.html'], 'de'))
assert_equal(@tree['/other.html'], @tree.translate_node(@tree['/other.html'], nil))
assert_equal(@tree['/other.html'], @tree.translate_node(@tree['/other.en.html'], nil))
assert_equal(@tree['/other.html'], @tree.translate_node(@tree['/other.en.html'], 'de'))
- assert_equal(nil, @tree.translate_node(@tree['/file.en.html#frag'], nil))
+ assert_nil(@tree.translate_node(@tree['/file.en.html#frag'], nil))
assert_equal(@tree['/file.en.html#frag'], @tree.translate_node(@tree['/file.en.html#frag'], 'en'))
assert_equal(@tree['/file.de.html#frag'], @tree.translate_node(@tree['/file.en.html#frag'], 'de'))
end
def test_translations
@@ -52,33 +52,33 @@
def test_resolve_node
setup_default_nodes(@tree)
[@tree['/'], @tree['/file.de.html'], @tree['/file.en.html'], @tree['/other.html']].each do |n|
- assert_equal(nil, n.resolve('file.html', nil))
+ assert_nil(n.resolve('file.html', nil))
assert_equal(@tree['/file.en.html'], n.resolve('file.html', 'en'))
assert_equal(@tree['/file.de.html'], n.resolve('file.html', 'de'))
- assert_equal(nil, n.resolve('file.html', 'fr'))
+ assert_nil(n.resolve('file.html', 'fr'))
assert_equal(@tree['/file.en.html'], n.resolve('file.en.html', nil))
assert_equal(@tree['/file.en.html'], n.resolve('file.en.html', 'en'))
assert_equal(@tree['/file.en.html'], n.resolve('file.en.html', 'de'))
- assert_equal(nil, n.resolve('somename.fr.html', 'de'))
+ assert_nil(n.resolve('somename.fr.html', 'de'))
assert_equal(@tree['/other.html'], n.resolve('other.html', nil))
assert_equal(@tree['/other.html'], n.resolve('other.html', 'fr'))
assert_equal(@tree['/other.en.html'], n.resolve('other.html', 'en'))
assert_equal(@tree['/other.en.html'], n.resolve('other.en.html', nil))
assert_equal(@tree['/other.en.html'], n.resolve('other.en.html', 'de'))
- assert_equal(nil, n.resolve('other.fr.html', nil))
- assert_equal(nil, n.resolve('other.fr.html', 'en'))
+ assert_nil(n.resolve('other.fr.html', nil))
+ assert_nil(n.resolve('other.fr.html', 'en'))
end
assert_equal(@tree['/file.en.html#frag'], @tree['/file.en.html'].resolve('#frag', 'de'))
assert_equal(@tree['/file.en.html#frag'], @tree['/file.en.html'].resolve('#frag', nil))
assert_equal(@tree['/file.en.html#nested'], @tree['/file.en.html'].resolve('#nested', nil))
- assert_equal(nil, @tree.resolve_node('/file.html#frag', nil))
+ assert_nil(@tree.resolve_node('/file.html#frag', nil))
assert_equal(@tree['/file.en.html#frag'], @tree.resolve_node('/file.html#frag', 'en'))
assert_equal(@tree['/file.de.html#frag'], @tree.resolve_node('/file.html#frag', 'de'))
assert_equal(@tree['/file.en.html#frag'], @tree.resolve_node('/file.en.html#frag', nil))
assert_equal(@tree['/file.de.html#frag'], @tree.resolve_node('/file.de.html#frag', nil))
@@ -89,13 +89,13 @@
assert_equal(@tree['/dir/'], @tree['/file.en.html'].resolve('/dir'))
assert_equal(@tree['/'], @tree['/file.en.html'].resolve('/'))
nrcalls = 0
@website.blackboard.add_listener(:node_resolution_failed) { nrcalls += 1 }
- assert_equal(nil, @tree['/'].resolve('other.fr.html', nil, false))
+ assert_nil(@tree['/'].resolve('other.fr.html', nil, false))
assert_equal(0, nrcalls)
- assert_equal(nil, @tree['/'].resolve('other.fr.html', nil, true))
+ assert_nil(@tree['/'].resolve('other.fr.html', nil, true))
assert_equal(1, nrcalls)
end
def test_register_node
node = Webgen::Node.new(@tree.dummy_root, '/', '/')
@@ -114,10 +114,10 @@
nrcalls = 0
@website.blackboard.add_listener(:before_node_deleted) { nrcalls += 1 }
root = Webgen::Node.new(@tree.dummy_root, '/', '/')
file = Webgen::Node.new(root, 'testfile', 'testfile')
- dir = Webgen::Node.new(root, 'testdir/', 'testdir')
+ Webgen::Node.new(root, 'testdir/', 'testdir')
virtual_root = Webgen::Node.new(root, 'vroot', '/', 'no_output' => true)
@tree.delete_node(@tree.dummy_root)
refute_nil(@tree[''])