diff options
author | Marin Jankovski <marin@gitlab.com> | 2014-01-23 10:43:04 +0100 |
---|---|---|
committer | Marin Jankovski <marin@gitlab.com> | 2014-01-23 10:43:04 +0100 |
commit | 462161a3b07369d0df68b0298929b3f89cf46c03 (patch) | |
tree | eeda7d6b746fd18ff3757f61c7f787b785a85367 | |
parent | 16ba8fa077145f99dff98501770ed80d0a58fd58 (diff) | |
download | gitlab-ce-462161a3b07369d0df68b0298929b3f89cf46c03.tar.gz |
Markdown helper spec for reference style relative links.
-rw-r--r-- | spec/helpers/gitlab_markdown_helper_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb index 33e69d4326c..a3efdffeebc 100644 --- a/spec/helpers/gitlab_markdown_helper_spec.rb +++ b/spec/helpers/gitlab_markdown_helper_spec.rb @@ -431,6 +431,24 @@ describe GitlabMarkdownHelper do expected = "<p><a href=\"/#{project.path_with_namespace}/wikis/test/link\">Link</a></p>\n" markdown(actual).should match(expected) end + + it "should handle relative urls in reference links for a file in master" do + actual = "[GitLab API doc][GitLab readme]\n [GitLab readme]: doc/api/README.md\n" + expected = "<p><a href=\"/#{project.path_with_namespace}/blob/master/doc/api/README.md\">GitLab API doc</a></p>\n" + markdown(actual).should match(expected) + end + + it "should handle relative urls in reference links for a directory in master" do + actual = "[GitLab API doc directory][GitLab readmes]\n [GitLab readmes]: doc/api/\n" + expected = "<p><a href=\"/#{project.path_with_namespace}/tree/master/doc/api/\">GitLab API doc directory</a></p>\n" + markdown(actual).should match(expected) + end + + it "should not handle malformed relative urls in reference links for a file in master" do + actual = "[GitLab readme]: doc/api/README.md\n" + expected = "" + markdown(actual).should match(expected) + end end describe "#render_wiki_content" do |