Sha256: 18414eb70e19b9d2be831076fba1321252e7049b83ac6e031699058c7eeacd8b

Contents?: true

Size: 773 Bytes

Versions: 3

Compression:

Stored size: 773 Bytes

Contents

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

require 'webgen/test_helper'
require 'webgen/content_processor/builder'

class TestBuilder < MiniTest::Unit::TestCase

  include Webgen::TestHelper

  def test_static_call
    setup_context
    cp = Webgen::ContentProcessor::Builder

    @context.content = "xml.div(:path => context.node.alcn) { xml.strong('test'); " +
      "context.website; context; context.ref_node; context.dest_node }"
    assert_equal("<div path=\"/test\">\n  <strong>test</strong>\n</div>\n", cp.call(@context).content)

    @context.content = "xml.div do \n5+5\n+=+6\nend"
    assert_error_on_line(SyntaxError, 3) { cp.call(@context) }

    @context.content = "xml.div do \n5+5\nunknown\n++6\nend"
    assert_error_on_line(NameError, 3) { cp.call(@context) }
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
webgen-1.0.0.beta3 test/webgen/content_processor/test_builder.rb
webgen-1.0.0.beta2 test/webgen/content_processor/test_builder.rb
webgen-1.0.0.beta1 test/webgen/content_processor/test_builder.rb