Sha256: 3f0f89763a7f566c6c6cf0ec0df4aec345c31d1476776d3fd20a6e74964522dd

Contents?: true

Size: 655 Bytes

Versions: 3

Compression:

Stored size: 655 Bytes

Contents

# coding: UTF-8
require 'test_helper'

class CustomRenderTest < Greenmat::TestCase
  class SimpleRender < Greenmat::Render::HTML
    def emphasis(text)
      "<em class=\"cool\">#{text}</em>"
    end
  end

  def test_simple_overload
    md = Greenmat::Markdown.new(SimpleRender)
    assert_equal "<p>This is <em class=\"cool\">just</em> a test</p>\n",
      md.render("This is *just* a test")
  end

  class NilPreprocessRenderer < Greenmat::Render::HTML
    def preprocess(fulldoc)
      nil
    end
  end

  def test_preprocess_returning_nil
    md = Greenmat::Markdown.new(NilPreprocessRenderer)
    assert_equal(nil,md.render("Anything"))
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
greenmat-3.2.0.2 test/custom_render_test.rb
greenmat-3.2.0.1 test/custom_render_test.rb
greenmat-3.2.0.0 test/custom_render_test.rb