Sha256: 03596409e6cef51aceb6c568e7d7f63de65179a7dc71d52fb02a513c811bc0bd
Contents?: true
Size: 779 Bytes
Versions: 17
Compression:
Stored size: 779 Bytes
Contents
# coding: UTF-8 $:.unshift(File.expand_path('../../lib', __FILE__)) Encoding.default_internal = 'UTF-8' require 'test/unit' require 'redcarpet' require 'redcarpet/render_strip' require 'redcarpet/render_man' class Redcarpet::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 = begin renderer.new(options) rescue ArgumentError renderer.new end parser = Redcarpet::Markdown.new(render, options) parser.render(markdown) end private def renderer @renderer ||= Redcarpet::Render::HTML end end
Version data entries
17 entries across 17 versions & 5 rubygems