Sha256: 8489301b2b198f60a77ea1cfd143f841ee13d2f9ae052d112572b59d368c67c7

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

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

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

3 entries across 3 versions & 3 rubygems

Version Path
gettalong-webgen-0.5.7.20090227 test/test_contentprocessor_maruku.rb
thewoolleyman-webgen-0.5.8.20090419 test/test_contentprocessor_maruku.rb
webgen-0.5.7 test/test_contentprocessor_maruku.rb