Commit 462161a3b07369d0df68b0298929b3f89cf46c03
1 parent
16ba8fa0
Exists in
spb-stable
and in
3 other branches
Markdown helper spec for reference style relative links.
Showing
1 changed file
with
18 additions
and
0 deletions
Show diff stats
spec/helpers/gitlab_markdown_helper_spec.rb
| ... | ... | @@ -431,6 +431,24 @@ describe GitlabMarkdownHelper do |
| 431 | 431 | expected = "<p><a href=\"/#{project.path_with_namespace}/wikis/test/link\">Link</a></p>\n" |
| 432 | 432 | markdown(actual).should match(expected) |
| 433 | 433 | end |
| 434 | + | |
| 435 | + it "should handle relative urls in reference links for a file in master" do | |
| 436 | + actual = "[GitLab API doc][GitLab readme]\n [GitLab readme]: doc/api/README.md\n" | |
| 437 | + expected = "<p><a href=\"/#{project.path_with_namespace}/blob/master/doc/api/README.md\">GitLab API doc</a></p>\n" | |
| 438 | + markdown(actual).should match(expected) | |
| 439 | + end | |
| 440 | + | |
| 441 | + it "should handle relative urls in reference links for a directory in master" do | |
| 442 | + actual = "[GitLab API doc directory][GitLab readmes]\n [GitLab readmes]: doc/api/\n" | |
| 443 | + expected = "<p><a href=\"/#{project.path_with_namespace}/tree/master/doc/api/\">GitLab API doc directory</a></p>\n" | |
| 444 | + markdown(actual).should match(expected) | |
| 445 | + end | |
| 446 | + | |
| 447 | + it "should not handle malformed relative urls in reference links for a file in master" do | |
| 448 | + actual = "[GitLab readme]: doc/api/README.md\n" | |
| 449 | + expected = "" | |
| 450 | + markdown(actual).should match(expected) | |
| 451 | + end | |
| 434 | 452 | end |
| 435 | 453 | |
| 436 | 454 | describe "#render_wiki_content" do | ... | ... |