Sha256: 842ea543667689083fdfdfb7560513ae572e1c0066e208b0a19a6f0216bb0c50
Contents?: true
Size: 1.93 KB
Versions: 3
Compression:
Stored size: 1.93 KB
Contents
require 'test/unit' require 'helper' require 'webgen/sourcehandler' require 'stringio' class TestSourceHandlerPage < Test::Unit::TestCase include Test::WebsiteHelper def setup super @website.blackboard.del_service(:templates_for_node) @website.blackboard.add_service(:templates_for_node) {|node| []} @obj = Webgen::SourceHandler::Page.new @root = Webgen::Node.new(Webgen::Tree.new.dummy_root, 'test/', 'test') @path = path_with_meta_info('/index.page') {StringIO.new('content')} @path.meta_info.update({'lang'=>'eo', 'test'=>'yes', 'sort_info'=>6}) @website.blackboard.add_service(:source_paths) {{@path.path => @path}} end def test_create_node node = @obj.create_node(@root, @path.dup) assert_not_nil(node) assert_equal('test/index.eo.html', node.path) assert_equal(@obj.class.name, node.node_info[:processor]) assert_equal('Index', node['title']) assert_equal('yes', node['test']) assert_equal(6, node['sort_info']) assert_equal(Webgen::LanguageManager.language_for_code('epo'), node.lang) assert_equal(node, @obj.create_node(@root, @path.dup)) @root.tree.delete_node(node) path = @path.dup def path.changed? false end @obj.create_node(@root, path) end def test_content node = @obj.create_node(@root, @path) assert_equal("content", @obj.content(node)) end def test_render_node node = @obj.create_node(@root, @path) assert_equal("content", @obj.render_node(node)) assert_raise(RuntimeError) { @obj.render_node(node, 'other') } end def test_meta_info_changed node = @obj.create_node(@root, @path) @website.blackboard.dispatch_msg(:node_meta_info_changed?, node) assert(!node.meta_info_changed?) @path.instance_eval { @io = Webgen::Path::SourceIO.new {StringIO.new("---\ntitle: test\n---\ncontent")} } @website.blackboard.dispatch_msg(:node_meta_info_changed?, node) assert(node.meta_info_changed?) end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
gettalong-webgen-0.5.5.20081012 | test/test_sourcehandler_page.rb |
gettalong-webgen-0.5.6.20081020 | test/test_sourcehandler_page.rb |
webgen-0.5.6 | test/test_sourcehandler_page.rb |