Sha256: 3d410b635758567e322a85b7189ca7b1aaf3baa8fc3719ec81a315565724bc25

Contents?: true

Size: 1.1 KB

Versions: 8

Compression:

Stored size: 1.1 KB

Contents

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

require 'test/unit'
require 'helper'
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::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(Webgen::RenderError) { @obj.call(context)}

    def @obj.require(lib); raise LoadError; end
    assert_raise(Webgen::LoadError) { @obj.call(context) }
  end

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

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

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
webgen-0.5.17 test/test_contentprocessor_maruku.rb
webgen-0.5.15 test/test_contentprocessor_maruku.rb
webgen-0.5.14 test/test_contentprocessor_maruku.rb
webgen-0.5.13 test/test_contentprocessor_maruku.rb
webgen-0.5.12 test/test_contentprocessor_maruku.rb
webgen-0.5.11 test/test_contentprocessor_maruku.rb
webgen-0.5.10 test/test_contentprocessor_maruku.rb
webgen-0.5.9 test/test_contentprocessor_maruku.rb