test/test_sourcehandler_fragment.rb in webgen-0.5.1 vs test/test_sourcehandler_fragment.rb in webgen-0.5.2

- old
+ new

@@ -41,16 +41,21 @@ end def test_create_fragment_nodes @obj = Webgen::SourceHandler::Fragment.new root = Webgen::Node.new(Webgen::Tree.new.dummy_root, 'test/', 'test') - node = @obj.create_node(root, path_with_meta_info('hallo.html') {StringIO.new('')}) - @website.blackboard.add_service(:create_nodes) {|tree, alcn, path, sh| [sh.create_node(tree[alcn], path_with_meta_info(path.path))]} + path = path_with_meta_info('hallo.html') {StringIO.new('')} + node = @obj.create_node(root, path) + @website.blackboard.add_service(:create_nodes, method(:create_nodes_service)) - section = @obj.parse_html_headers(YAML::load(TEST_CONTENT).first['data']) - @obj.create_fragment_nodes(section, node, 'true') + sections = @obj.parse_html_headers(YAML::load(TEST_CONTENT).first['data']) + @obj.create_fragment_nodes(sections, node, path, 'true') assert_equal(node, node.resolve('#test').parent) assert_equal(node.resolve('#test'), node.resolve('#other').parent) + end + + def create_nodes_service(tree, alcn, path, sh) + [yield(tree[alcn], path_with_meta_info(path.path))] end def check_sections(sections, valid) sections.each do |level, id, title, subsecs| assert_equal(valid.shift, [level, id, title])