better, simpler test case...
This commit is contained in:
parent
71e625e02c
commit
470abf46e2
|
@ -452,48 +452,30 @@ CONTENT
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "with fenced code blocks with backticks" do
|
||||||
|
|
||||||
context "with maruku and fenced code blocks with backticks" do
|
# setup do
|
||||||
|
# @config = {
|
||||||
|
# 'markdown' => 'maruku',
|
||||||
|
# 'maruku' => {
|
||||||
|
# 'fenced_code_blocks' => true
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
# end
|
||||||
setup do
|
setup do
|
||||||
@config = {
|
content = <<CONTENT
|
||||||
'markdown' => 'maruku',
|
|
||||||
'maruku' => {
|
|
||||||
'fenced_code_blocks' => true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
context "with pygments enabled" do
|
|
||||||
setup do
|
|
||||||
@markdown = Converters::Markdown.new @config.merge({ 'pygments' => true })
|
|
||||||
end
|
|
||||||
|
|
||||||
should "render fenced code blocks with syntax highlighting" do
|
|
||||||
assert_equal "<div class=\"highlight\"><pre><code class=\"ruby language-ruby\" data-lang=\"ruby\"><span class=\"nb\">puts</span> <span class=\"s2\">"Hello world"</span>\n</code></pre></div>", @markdown.convert(
|
|
||||||
<<-EOS
|
|
||||||
```ruby
|
```ruby
|
||||||
puts "Hello world"
|
puts "Hello world"
|
||||||
```
|
```
|
||||||
EOS
|
CONTENT
|
||||||
).strip
|
create_post(content, {
|
||||||
end
|
'maruku' => {'fenced_code_blocks' => true}}
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with pygments disabled" do
|
# todo: if #112 is merged into maruku, update to remove the newlines inside code block
|
||||||
setup do
|
should "render fenced code blocks" do
|
||||||
@markdown = Converters::Markdown.new @config.merge({ 'pygments' => false })
|
assert_match %r{<pre class=\"ruby\"><code class=\"ruby\">\nputs "Hello world"\n</code></pre>}, @result.strip
|
||||||
end
|
|
||||||
|
|
||||||
should "render fenced code blocks without syntax highlighting" do
|
|
||||||
assert_equal "<pre class=\"ruby\"><code class=\"ruby\">\nputs "Hello world"\n</code></pre>", @markdown.convert(
|
|
||||||
<<-EOS
|
|
||||||
```ruby
|
|
||||||
puts "Hello world"
|
|
||||||
```
|
|
||||||
EOS
|
|
||||||
).strip
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue