Sha256: 0408e3bfb7e2f76c4840789665bfdab8c7f9d5d10b8fb87df6d6f3002bac63b3
Contents?: true
Size: 1.31 KB
Versions: 2
Compression:
Stored size: 1.31 KB
Contents
require 'test/unit' require 'helper' require 'webgen/sourcehandler' require 'stringio' class TestSourceHandlerVirtual < Test::Unit::TestCase include Test::WebsiteHelper CONTENT=<<EOF \\--- !omap - path.de.html: - /dir/: title: My Dir - /dir/file.html: - /directory/path.en.html: url: other.html title: new title EOF def test_create_node obj = Webgen::SourceHandler::Virtual.new root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/') shm = Webgen::SourceHandler::Main.new # for using service :create_nodes time = Time.now nodes = obj.create_node(root, path_with_meta_info('/virtuals', {'modified_at' => time}, obj.class.name) {StringIO.new(CONTENT)}) nodes.each {|n| assert_equal('/virtuals', n.node_info[:src])} path_de = root.tree['/path.de.html'] path_en = root.tree['/directory/path.en.html'] dir = root.tree['/dir'] assert_not_nil(path_de) assert_not_nil(dir) assert_not_nil(path_en) assert_equal('new title', path_en['title']) assert_equal(time, path_en['modified_at']) assert(path_en['no_output']) assert_equal('My Dir', dir['title']) assert_equal('directory/other.html', path_de.route_to(path_en)) assert_equal('../path.de.html', dir.route_to(path_de)) assert_equal('../directory/other.html', dir.route_to(path_en)) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
webgen-0.5.3 | test/test_sourcehandler_virtual.rb |
webgen-0.5.4 | test/test_sourcehandler_virtual.rb |