Sha256: 09a0a7d8c7baacbb6d94db07efe6fd6a2af7eab234e22e61db25365798f3302f

Contents?: true

Size: 846 Bytes

Versions: 2

Compression:

Stored size: 846 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'test/unit'
require 'helper'
require 'webgen/tree'
require 'webgen/contentprocessor'

class TestContentProcessorBuilder < Test::Unit::TestCase

  def test_call
    obj = Webgen::ContentProcessor::Builder.new
    root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/')
    node = Webgen::Node.new(root, 'test', 'test')
    content = "xml.div(:path => context.node.alcn) { xml.strong('test'); " +
      "context.website; context; context.ref_node; context.dest_node }"
    context = Webgen::Context.new(:content => content,
                                                    :chain => [node])
    assert_equal("<div path=\"/test\">\n  <strong>test</strong>\n</div>\n", obj.call(context).content)

    context.content = 'raise "bla"'
    assert_raise(RuntimeError) { obj.call(context).content }
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gettalong-webgen-0.5.9.20090620 test/test_contentprocessor_builder.rb
gettalong-webgen-0.5.9.20090626 test/test_contentprocessor_builder.rb