2016-04-01 05:33:25 +08:00
|
|
|
|
require "rails_helper"
|
2014-06-06 08:34:21 +08:00
|
|
|
|
require_dependency "import/normalize"
|
|
|
|
|
|
|
|
|
|
describe Import::Normalize do
|
|
|
|
|
describe "#normalize_code_blocks" do
|
|
|
|
|
it "normalizes 2 code blocks correctly" do
|
|
|
|
|
markdown = <<MD
|
|
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
|
<code>
|
|
|
|
|
I am a te "
|
|
|
|
|
</code></pre>
|
|
|
|
|
test
|
|
|
|
|
<pre><code>this is a ""</code></pre>
|
|
|
|
|
MD
|
|
|
|
|
expected = " \n \n```\n I am a te \"\n \n```\n\n test \n \n```\nthis is a \"\"\n```\n\n"
|
2015-01-10 00:34:37 +08:00
|
|
|
|
expect(Import::Normalize.normalize_code_blocks(markdown)).to eq(expected)
|
2014-06-06 08:34:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|