Sha256: d67e968102f374742c44fa6725b062a53a3af3de0a8cc46461c9e6873a2726dd

Contents?: true

Size: 827 Bytes

Versions: 2

Compression:

Stored size: 827 Bytes

Contents

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

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

class TestContentProcessorErb < Test::Unit::TestCase

  def test_call
    obj = Webgen::ContentProcessor::Erb.new
    root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/')
    node = Webgen::Node.new(root, 'test', 'test')
    content = "<%= context[:doit] %>6\n<%= context.ref_node.absolute_lcn %>\n<%= context.node.absolute_lcn %>\n<%= context.dest_node.absolute_lcn %><% website %>"
    context = Webgen::Context.new(:content => content, :doit => 'hallo',
                                                    :chain => [node])
    obj.call(context)
    assert_equal("hallo6\n/test\n/test\n/test", context.content)

    context.content = '<%= 5* %>'
    assert_raise(RuntimeError) { obj.call(context) }
  end

end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
gettalong-webgen-0.5.8.20090507 test/test_contentprocessor_erb.rb
webgen-0.5.8 test/test_contentprocessor_erb.rb