test/test_pandoc-ruby.rb in pandoc-ruby-0.4.1 vs test/test_pandoc-ruby.rb in pandoc-ruby-0.5.0
- old
+ new
@@ -25,11 +25,11 @@
converter.expects(:execute).with("#{path}/pandoc").returns(true)
assert converter.convert
end
should "treat file paths as strings by default" do
- assert_equal "<p\n>#{@file}</p\n>", PandocRuby.new(@file).to_html
+ assert_equal "<p>#{@file}</p>", PandocRuby.new(@file).to_html
end
should "treat file paths as file paths when enabled" do
PandocRuby.allow_file_paths = true
assert PandocRuby.new(@file).to_html.match(%r{This is a Title})
@@ -46,24 +46,37 @@
converter.expects(:execute).with('pandoc --to=rst').returns(true)
assert converter.convert
end
should "accept a variety of options in initializer" do
- converter = PandocRuby.new(@file, :s, {:f => :markdown, :to => :rst}, 'no-wrap')
- converter.expects(:execute).with('pandoc -s -f markdown --to=rst --no-wrap').returns(true)
+ converter = PandocRuby.new(@file, :s, {
+ :f => :markdown, :to => :rst
+ }, 'no-wrap')
+ converter \
+ .expects(:execute) \
+ .with('pandoc -s --to=rst -f markdown --no-wrap') \
+ .returns(true)
assert converter.convert
end
should "accept a variety of options in convert" do
converter = PandocRuby.new(@file)
- converter.expects(:execute).with('pandoc -s -f markdown --to=rst --no-wrap').returns(true)
+ converter \
+ .expects(:execute) \
+ .with('pandoc -s --to=rst -f markdown --no-wrap') \
+ .returns(true)
assert converter.convert(:s, {:f => :markdown, :to => :rst}, 'no-wrap')
end
should "convert underscore symbol ares to hyphenated long options" do
- converter = PandocRuby.new(@file, {:email_obfuscation => :javascript}, :table_of_contents)
- converter.expects(:execute).with('pandoc --email-obfuscation=javascript --table-of-contents').returns(true)
+ converter = PandocRuby.new(@file, {
+ :email_obfuscation => :javascript
+ }, :table_of_contents)
+ converter \
+ .expects(:execute) \
+ .with('pandoc --email-obfuscation=javascript --table-of-contents') \
+ .returns(true)
assert converter.convert
end
should "accept optional executable" do
converter = PandocRuby.new(@file, 'html2markdown')
@@ -86,11 +99,14 @@
end
PandocRuby::WRITERS.each_key do |w|
should "convert to #{w} with to_#{w}" do
converter = PandocRuby.new(@file)
- converter.expects(:execute).with("pandoc --no-wrap --to=#{w}").returns(true)
+ converter \
+ .expects(:execute) \
+ .with("pandoc --no-wrap --to=#{w}") \
+ .returns(true)
assert converter.send("to_#{w}", :no_wrap)
end
end
should "work with strings" do
@@ -117,28 +133,44 @@
end
end
should "have reader and writer constants" do
assert_equal PandocRuby::READERS, {
- 'rst' => 'reStructuredText',
- 'markdown' => 'markdown',
- 'html' => 'HTML',
- 'latex' => 'LaTeX'
+ "html" => "HTML",
+ "latex" => "LaTeX",
+ "textile" => "textile",
+ "native" => "pandoc native",
+ "markdown" => "markdown",
+ "json" => "pandoc JSON",
+ "rst" => "reStructuredText"
}
assert_equal PandocRuby::WRITERS, {
- 'markdown' => 'markdown',
- 'rst' => 'reStructuredText',
- 'html' => 'HTML',
- 'latex' => 'LaTeX',
- 'context' => 'ConTeXt',
- 'man' => 'groff man',
- 'mediawiki' => 'MediaWiki markup',
- 'texinfo' => 'GNU Texinfo',
- 'docbook' => 'DocBook XML',
- 'opendocument' => 'OpenDocument XML',
- 's5' => 'S5 HTML and javascript slide show',
- 'rtf' => 'rich text format'
+ "mediawiki" => "MediaWiki markup",
+ "html" => "HTML",
+ "plain" => "plain",
+ "docx" => "docx",
+ "latex" => "LaTeX",
+ "s5" => "S5 HTML slideshow",
+ "textile" => "textile",
+ "texinfo" => "GNU Texinfo",
+ "docbook" => "DocBook XML",
+ "html5" => "HTML5",
+ "native" => "pandoc native",
+ "epub" => "epub",
+ "org" => "emacs org mode",
+ "rtf" => "rich text format",
+ "markdown" => "markdown",
+ "man" => "groff man",
+ "dzslides" => "Dzslides HTML slideshow",
+ "beamer" => "Beamer PDF slideshow",
+ "json" => "pandoc JSON",
+ "opendocument" => "OpenDocument XML",
+ "slidy" => "Slidy HTML slideshow",
+ "rst" => "reStructuredText",
+ "context" => "ConTeXt",
+ "odt" => "odt",
+ "asciidoc" => "asciidoc"
}
end
end