test/quesadilla/markdown_test.rb in quesadilla-0.1.0 vs test/quesadilla/markdown_test.rb in quesadilla-0.1.1
- old
+ new
@@ -3,11 +3,11 @@
module Quesadilla
class MarkdownTest < TestCase
def test_that_it_extracts_links
extraction = extract('Read [my resume](http://samsoff.es/resume) if you want')
- assert_equal extraction, {
+ expected = {
display_text: 'Read my resume if you want',
display_html: 'Read <a href="http://samsoff.es/resume" rel="external nofollow" class="link">my resume</a> if you want',
entities: [
{
type: 'link',
@@ -17,15 +17,16 @@
indices: [5, 42],
display_indices: [5, 14]
}
]
}
+ assert_equal expected, extraction
end
def test_that_it_extracts_links_with_titles
extraction = extract('Read [my resume](http://samsoff.es/resume "Sam\'s Resume") if you want')
- assert_equal extraction, {
+ expected = {
display_text: 'Read my resume if you want',
display_html: 'Read <a href="http://samsoff.es/resume" rel="external nofollow" class="link" title="Sam's Resume">my resume</a> if you want',
entities: [
{
type: 'link',
@@ -36,15 +37,16 @@
indices: [5, 57],
display_indices: [5, 14]
}
]
}
+ assert_equal expected, extraction
end
def test_that_it_extracts_links_with_brackets
extraction = extract('Something with a link: <http://samsoff.es/posts/hire-sam>')
- assert_equal extraction, {
+ expected = {
display_text: 'Something with a link: samsoff.es/posts/hire-sam',
display_html: 'Something with a link: <a href="http://samsoff.es/posts/hire-sam" rel="external nofollow" class="link">samsoff.es/posts/hire-sam</a>',
entities: [
{
type: 'link',
@@ -54,15 +56,16 @@
indices: [23, 57],
display_indices: [23, 48]
}
]
}
+ assert_equal expected, extraction
end
def test_that_it_extracts_email_addresses_with_brackets
extraction = extract('Email <support@cheddarapp.com>')
- assert_equal extraction, {
+ expected = {
display_text: 'Email support@cheddarapp.com',
display_html: 'Email <a href="mailto:support@cheddarapp.com" rel="external nofollow" class="link">support@cheddarapp.com</a>',
entities: [
{
type: 'link',
@@ -72,17 +75,18 @@
indices: [6, 30],
display_indices: [6, 28]
}
]
}
+ assert_equal expected, extraction
end
# it 'should extract plain email addresses'
def test_that_it_extracts_emphasis
extraction = extract('Something *cool* is awesome')
- assert_equal extraction, {
+ expected = {
display_text: 'Something cool is awesome',
display_html: 'Something <em>cool</em> is awesome',
entities: [
{
type: 'emphasis',
@@ -91,13 +95,14 @@
indices: [10, 16],
display_indices: [10, 14]
}
]
}
+ assert_equal expected, extraction
extraction = extract('Something _cool_ is awesome')
- assert_equal extraction, {
+ expected = {
display_text: 'Something cool is awesome',
display_html: 'Something <em>cool</em> is awesome',
entities: [
{
type: 'emphasis',
@@ -106,15 +111,16 @@
indices: [10, 16],
display_indices: [10, 14]
}
]
}
+ assert_equal expected, extraction
end
def test_that_it_extracts_double_emphasis
extraction = extract('Something **cool** is awesome')
- assert_equal extraction, {
+ expected = {
display_text: 'Something cool is awesome',
display_html: 'Something <strong>cool</strong> is awesome',
entities: [
{
type: 'double_emphasis',
@@ -123,13 +129,14 @@
indices: [10, 18],
display_indices: [10, 14]
}
]
}
+ assert_equal expected, extraction
extraction = extract('Something __cool__ is awesome')
- assert_equal extraction, {
+ expected = {
display_text: 'Something cool is awesome',
display_html: 'Something <strong>cool</strong> is awesome',
entities: [
{
type: 'double_emphasis',
@@ -138,15 +145,16 @@
indices: [10, 18],
display_indices: [10, 14]
}
]
}
+ assert_equal expected, extraction
end
def test_that_it_extracts_triple_emphasis
extraction = extract('Something ***cool*** is awesome')
- assert_equal extraction, {
+ expected = {
display_text: 'Something cool is awesome',
display_html: 'Something <strong><em>cool</em></strong> is awesome',
entities: [
{
type: 'triple_emphasis',
@@ -155,13 +163,14 @@
indices: [10, 20],
display_indices: [10, 14]
}
]
}
+ assert_equal expected, extraction
extraction = extract('Something ___cool___ is awesome')
- assert_equal extraction, {
+ expected = {
display_text: 'Something cool is awesome',
display_html: 'Something <strong><em>cool</em></strong> is awesome',
entities: [
{
type: 'triple_emphasis',
@@ -170,15 +179,16 @@
indices: [10, 20],
display_indices: [10, 14]
}
]
}
+ assert_equal expected, extraction
end
def test_that_it_extracts_strikethrough
extraction = extract('Something ~~cool~~ awesome')
- assert_equal extraction, {
+ expected = {
display_text: 'Something cool awesome',
display_html: 'Something <del>cool</del> awesome',
entities: [
{
type: 'strikethrough',
@@ -187,15 +197,16 @@
indices: [10, 18],
display_indices: [10, 14]
}
]
}
+ assert_equal expected, extraction
end
def test_that_it_extracts_multiple_strikethroughs
extraction = extract('Something ~~cool~~ awesome ~~foo~~')
- assert_equal extraction, {
+ expected = {
display_text: 'Something cool awesome foo',
display_html: 'Something <del>cool</del> awesome <del>foo</del>',
entities: [
{
type: 'strikethrough',
@@ -211,15 +222,16 @@
indices: [27, 34],
display_indices: [23, 26]
}
]
}
+ assert_equal expected, extraction
end
def test_that_it_extracts_code
extraction = extract('Something with `code` is awesome')
- assert_equal extraction, {
+ expected = {
display_text: 'Something with code is awesome',
display_html: 'Something with <code>code</code> is awesome',
entities: [
{
type: 'code',
@@ -228,8 +240,9 @@
indices: [15, 21],
display_indices: [15, 19]
}
]
}
+ assert_equal expected, extraction
end
end
end