forked from jedi4ever/markdown2confluence
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5519cac
commit 1e475f0
Showing
7 changed files
with
87 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
source "http:https://rubygems.org" | ||
|
||
gem "markdown2confluence", :path => "." | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
require 'bundler/setup' | ||
Bundler::GemHelper.install_tasks | ||
|
||
require 'rake/testtask' | ||
Rake::TestTask.new(:test) do |test| | ||
test.libs << 'lib' << 'test' | ||
test.pattern = 'test/**/*_test.rb' | ||
test.verbose = false | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
require 'test_helper' | ||
|
||
class Markdown2ConfluenceTest < ActiveSupport::TestCase | ||
test "header 1" do | ||
assert_equal "h1. Hello\n", confluence("# Hello") | ||
end | ||
|
||
test "heading 2" do | ||
assert_equal "h2. Hello\n", confluence("## Hello") | ||
end | ||
|
||
test "heading 3" do | ||
assert_equal "h3. Hello\n", confluence("### Hello") | ||
end | ||
|
||
test "heading 4" do | ||
assert_equal "h4. Hello\n", confluence("#### Hello") | ||
end | ||
|
||
# TODO - remove these extra spaces after - symbol | ||
test "lists" do | ||
list = "* this\n" | ||
list << "* is\n" | ||
list << "* a\n" | ||
list << "* list\n" | ||
confluence_list = list.gsub("*", "- ").gsub("\n", "\n\n") | ||
assert_equal confluence_list, confluence(list) | ||
end | ||
|
||
# TODO - two trailing newlines | ||
test "strong text" do | ||
assert_equal "*strong*\n\n", confluence("**strong**") | ||
end | ||
|
||
# TODO - two trailing newlines | ||
test "italics text" do | ||
assert_equal "_some text here_\n\n", confluence("*some text here*") | ||
end | ||
|
||
# TODO - two trailing newlines | ||
test "inline code" do | ||
assert_equal "{{hello world}}\n\n", confluence("`hello world`") | ||
end | ||
|
||
test "block of code" do | ||
code = " this is code\n" | ||
assert_equal "{code}this is code\n{code}\n", confluence(code) | ||
end | ||
|
||
# TODO - two trailing newlines | ||
# FIX - failing test | ||
test "strikethrough" do | ||
assert_equal "-strikethrough text-\n\n", confluence("~~strikethrough text~~") | ||
end | ||
|
||
# FIX - failing test | ||
test "quote" do | ||
assert_equal "bq. this is a quote", confluence("> this is a quote") | ||
end | ||
|
||
private | ||
|
||
def confluence(text) | ||
Kramdown::Document.new(text).to_confluence | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require 'test/unit' | ||
require 'active_support/test_case' | ||
require 'turn' | ||
require 'markdown2confluence' |