diff options
author | Riyad Preukschas <riyad@informatik.uni-bremen.de> | 2013-01-17 01:37:39 +0400 |
---|---|---|
committer | Riyad Preukschas <riyad@informatik.uni-bremen.de> | 2013-01-17 01:39:56 +0400 |
commit | 2bc78739a7aa9d7e5109281fc45dbd41a1a576d4 (patch) | |
tree | 19bf8b9cbd72f293ca3f0da7cc7f1eb1365d11a9 /spec | |
parent | 16b54178422b5e84e0ddd61a7a44306d7b164707 (diff) |
Fix parsing of ref-like Urls in links and images in GFM
Fixes #2166
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 b7e16f1ee26..6d17c4eaf16 100644 --- a/spec/helpers/gitlab_markdown_helper_spec.rb +++ b/spec/helpers/gitlab_markdown_helper_spec.rb @@ -1,6 +1,8 @@ require "spec_helper" describe GitlabMarkdownHelper do + include ApplicationHelper + let!(:project) { create(:project) } let(:user) { create(:user, username: 'gfm') } @@ -340,6 +342,18 @@ describe GitlabMarkdownHelper do markdown("\nDon't use `$#{snippet.id}` here.\n").should == "<p>Don't use <code>$#{snippet.id}</code> here.</p>\n" end + it "should leave ref-like autolinks untouched" do + markdown("look at http://example.tld/#!#{merge_request.id}").should == "<p>look at <a href=\"http://example.tld/#!#{merge_request.id}\">http://example.tld/#!#{merge_request.id}</a></p>\n" + end + + it "should leave ref-like href of 'manual' links untouched" do + markdown("why not [inspect !#{merge_request.id}](http://example.tld/#!#{merge_request.id})").should == "<p>why not <a href=\"http://example.tld/#!#{merge_request.id}\">inspect </a><a href=\"http://test.host/project60/merge_requests/#{merge_request.id}\" class=\"gfm gfm-merge_request \" title=\"Merge Request: #{merge_request.title}\">!#{merge_request.id}</a><a href=\"http://example.tld/#!#{merge_request.id}\"></a></p>\n" + end + + it "should leave ref-like src of images untouched" do + markdown("screen shot: ![some image](http://example.tld/#!#{merge_request.id})").should == "<p>screen shot: <img src=\"http://example.tld/#!#{merge_request.id}\" alt=\"some image\"></p>\n" + end + it "should generate absolute urls for refs" do markdown("##{issue.id}").should include(project_issue_url(project, issue)) end |