Sha256: 90ce1b296c0d74abc380128f8cb1c97c732106fde763ba7b0c9d0bfc1c844a10

Contents?: true

Size: 1020 Bytes

Versions: 9

Compression:

Stored size: 1020 Bytes

Contents

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

class TestContentProcessorMaruku < Test::Unit::TestCase

  def test_call
    @obj = Webgen::ContentProcessor::Maruku.new
    node = Webgen::Node.new(Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/'), 'test', 'test')
    context = Webgen::ContentProcessor::Context.new(:content => '# header', :chain => [node])
    assert_equal('<h1 id=\'header\'>header</h1>', @obj.call(context).content)

    context.content = "# head*d* {#das .dsaf "
    assert_raise(RuntimeError) { @obj.call(context)}
  end

  def test_call_fix_for_invalid_id
    @obj = Webgen::ContentProcessor::Maruku.new
    context = Webgen::ContentProcessor::Context.new(:content => '# `test`')
    assert_equal('<h1 id=\'id1\'><code>test</code></h1>', @obj.call(context).content)

    context = Webgen::ContentProcessor::Context.new(:content => '# `test`')
    assert_equal('<h1 id=\'id1\'><code>test</code></h1>', @obj.call(context).content)
  end

end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
gettalong-webgen-0.5.4.20080929 test/test_contentprocessor_maruku.rb
gettalong-webgen-0.5.5.20081001 test/test_contentprocessor_maruku.rb
gettalong-webgen-0.5.5.20081010 test/test_contentprocessor_maruku.rb
gettalong-webgen-0.5.5.20081012 test/test_contentprocessor_maruku.rb
gettalong-webgen-0.5.6.20081020 test/test_contentprocessor_maruku.rb
webgen-0.5.3 test/test_contentprocessor_maruku.rb
webgen-0.5.4 test/test_contentprocessor_maruku.rb
webgen-0.5.6 test/test_contentprocessor_maruku.rb
webgen-0.5.5 test/test_contentprocessor_maruku.rb