diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-26 10:13:38 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-26 10:13:38 +0300 |
commit | 1e673c72a1a9ce1f5f4291e2f8dbc4db220f55cb (patch) | |
tree | 4a157299986110e78c146dee38b8d21ca7874c5a /spec | |
parent | 4d482b3b0c6ea6747f74e2eb0231631498496b59 (diff) | |
download | gitlab-ce-1e673c72a1a9ce1f5f4291e2f8dbc4db220f55cb.tar.gz |
Improve markdown parsing
* dont try to build links for anchors like `#title-anchor`
* dont build relative url for project with empty repo
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/helpers/gitlab_markdown_helper_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb index fc9d1ac90c0..f176a393415 100644 --- a/spec/helpers/gitlab_markdown_helper_spec.rb +++ b/spec/helpers/gitlab_markdown_helper_spec.rb @@ -5,6 +5,7 @@ describe GitlabMarkdownHelper do include IssuesHelper let!(:project) { create(:project) } + let(:empty_project) { create(:empty_project) } let(:user) { create(:user, username: 'gfm') } let(:commit) { project.repository.commit } @@ -506,6 +507,19 @@ describe GitlabMarkdownHelper do end end + describe "markdwon for empty repository" do + before do + @project = empty_project + @repository = empty_project.repository + end + + it "should not touch relative urls" do + actual = "[GitLab API doc][GitLab readme]\n [GitLab readme]: doc/api/README.md\n" + expected = "<p><a href=\"doc/api/README.md\">GitLab API doc</a></p>\n" + markdown(actual).should match(expected) + end + end + describe "#render_wiki_content" do before do @wiki = double('WikiPage') |