forked from railsbridge/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmarkdown_spec.rb
48 lines (40 loc) · 1.36 KB
/
markdown_spec.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
require "spec_helper"
require "site"
require "markdown_page"
describe MarkdownPage do
before do
setup_test_translations
end
it "renders markdown into html" do
src = <<-MARKDOWN.strip_heredoc
# This is a heading
## This is a subheading
<h2>This text is preformatted and escaped</h2>
```html
This text is preformatted and ready to be <strong>syntax highlighted</strong> as HTML source.
```
MARKDOWN
page = MarkdownPage.new(
src: src,
site: Site.new("greetings"),
page_name: 'hello',
doc_title: "Hello",
doc_path: "/tmp/hello.step",
locale: "en"
)
html_doc = Nokogiri.parse(page.to_html)
main_html = html_doc.css("main").first.serialize(:save_with => 0).chomp
expect(main_html).to loosely_equal(<<-HTML.strip_heredoc)
<main>
<a href="hello.step.deck" style="float: right">Slides</a>
<h1 class="doc_title">Hello</h1>
<div class="doc">
<h1>This is a heading</h1>
<h2>This is a subheading</h2>
<pre class="CodeRay"><h2>This text is preformatted and escaped</h2></pre>
<pre class="CodeRay">This text is preformatted and ready to be <span class="tag"><strong></span>syntax highlighted<span class="tag"></strong></span> as HTML source.</pre>
</div>
</main>
HTML
end
end