Sha256: d566061a30ab696dd5130062d2cb728f960f7523fe3b8992629451384e576480

Contents?: true

Size: 1.66 KB

Versions: 17

Compression:

Stored size: 1.66 KB

Contents

# coding: UTF-8
require 'test_helper'

class StripDownRender < Redcarpet::TestCase
  def setup
    @renderer = Redcarpet::Render::StripDown
  end

  def test_titles
    markdown = "# Foo bar"
    output   = render(markdown)

    assert_equal "Foo bar\n", output
  end

  def test_code_blocks
    markdown = "\tclass Foo\n\tend"
    output   = render(markdown)

    assert_equal "class Foo\nend\n", output
  end

  def test_images
    markdown = "Look at this ![picture](http://example.org/picture.png)\n" \
               "And this: ![](http://example.org/image.jpg)"
    expected = "Look at this picture http://example.org/picture.png\n" \
               "And this: http://example.org/image.jpg\n"
    output   = render(markdown)

    assert_equal expected, output
  end

  def test_links
    markdown = "Here's an [example](https://github.com)"
    expected = "Here's an example (https://github.com)\n"
    output   = render(markdown)

    assert_equal expected, output
  end

  def test_tables
    markdown = "| Left-Aligned  | Centre Aligned  | Right Aligned |\n" \
               "| :------------ |:---------------:| -----:|\n" \
               "| col 3 is      | some wordy text | $1600 |\n" \
               "| col 2 is      | centered        |   $12 |"
    expected = "Left-Aligned\tCentre Aligned\tRight Aligned\t\n" \
               "col 3 is\tsome wordy text\t$1600\t\n" \
               "col 2 is\tcentered\t$12\t\n"
    output   = render(markdown, with: [:tables])

    assert_equal expected, output
  end

  def test_highlight
    markdown = "==Hello world!=="
    expected = "Hello world!\n"
    output   = render(markdown, with: [:highlight])

    assert_equal expected, output
  end
end

Version data entries

17 entries across 17 versions & 5 rubygems

Version Path
mumukit-content-type-1.11.1 vendor/bundle/ruby/2.6.0/gems/redcarpet-3.3.4/test/stripdown_render_test.rb
tdiary-5.0.2 vendor/bundle/gems/redcarpet-3.3.4/test/stripdown_render_test.rb
tdiary-5.0.1 vendor/bundle/gems/redcarpet-3.3.4/test/stripdown_render_test.rb
redcarpet_yt-0.1.0 test/stripdown_render_test.rb
redcarpet_yt-0.0.10 test/stripdown_render_test.rb
redcarpet_yt-0.0.9 test/stripdown_render_test.rb
redcarpet_yt-0.0.8 test/stripdown_render_test.rb
redcarpet_yt-0.0.7 test/stripdown_render_test.rb
redcarpet_yt-0.0.6 test/stripdown_render_test.rb
redcarpet_yt-0.0.5 test/stripdown_render_test.rb
redcarpet_yt-0.0.4 test/stripdown_render_test.rb
redcarpet_yt-0.0.3 test/stripdown_render_test.rb
redcarpet_yt-0.0.2 test/stripdown_render_test.rb
redcarpet_yt-0.0.1 test/stripdown_render_test.rb
redcarpet-3.3.4 test/stripdown_render_test.rb
redcarpet-3.3.3 test/stripdown_render_test.rb
tight-redcarpet-3.3.2t test/stripdown_render_test.rb