Sha256: fefce89e961acdae72419fa8a30cf77c1f5c8e8ae120a9a0decaf8870e6d1b97

Contents?: true

Size: 677 Bytes

Versions: 3

Compression:

Stored size: 677 Bytes

Contents

# coding: UTF-8
Encoding.default_internal = 'UTF-8' if defined? Encoding

require 'test/unit'

require 'greenmat'
require 'greenmat/render_strip'
require 'greenmat/render_man'

class Greenmat::TestCase < Test::Unit::TestCase
  def assert_renders(html, markdown)
    assert_equal html, render(markdown)
  end

  def render(markdown, options = {})
    options = options.fetch(:with, {})

    if options.kind_of?(Array)
      options = Hash[options.map {|o| [o, true]}]
    end

    render = renderer.new(options)
    parser = Greenmat::Markdown.new(render, options)

    parser.render(markdown)
  end

  private

  def renderer
    @renderer ||= Greenmat::Render::HTML
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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