-
Notifications
You must be signed in to change notification settings - Fork 525
/
Copy pathstripdown_render_test.rb
69 lines (54 loc) · 1.87 KB
/
stripdown_render_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# 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", output
end
def test_code_blocks
markdown = "\tclass Foo\n\tend"
output = render(markdown)
assert_equal "class Foo\nend", output
end
def test_images
markdown = "Look at this \n" \
"And this: "
expected = "Look at this picture http://example.org/picture.png\n" \
"And this: http://example.org/image.jpg"
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)"
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"
output = render(markdown, with: [:tables])
assert_equal expected, output
end
def test_highlight
markdown = "==Hello world!=="
expected = "Hello world!"
output = render(markdown, with: [:highlight])
assert_equal expected, output
end
def test_with_quote_option_enabled
markdown = %(A common idiom is "Hello world")
expected = %(A common idiom is Hello world)
output = render(markdown, with: [:quote])
assert_equal expected, output
end
end