test/devcenter-parser_test.rb in devcenter-parser-1.1.0 vs test/devcenter-parser_test.rb in devcenter-parser-1.2.0

- old
+ new

@@ -182,9 +182,27 @@ md = "foo -- bar" html = '<p>foo – bar</p>' assert_all_flavours_result(md, html) end + it 'converts relative links with missing initial slashes to article links' do + ['foo', 'foo/bar', 'foo#bar', '123'].each do |href| + md = "[link](#{href})" + html = "<p><a href=\"/articles/#{href}\">link</a></p>" + assert_maruku_result md, html + assert_github_result md, html + end + end + + it 'does not alter relative links with initial slashes nor absolute links' do + ['http://foo.com', 'https://foo.com', '/foo', '/foo/bar', '/foo#bar', '/123', 'mailto:foo@foobar.com'].each do |href| + md = "[link](#{href})" + html = "<p><a href=\"#{href}\">link</a></p>" + assert_maruku_result md, html + assert_github_result md, html + end + end + end # helpers \ No newline at end of file