Commit d520fe07 authored by Robert Speicher's avatar Robert Speicher
Browse files

Fix GitlabMarkdownHelper spec

parent 5f13cf95e4cb
......@@ -51,8 +51,8 @@ def url_helper(image_name)
end
it "should not touch HTML entities" do
allow(@project.issues).to receive(:where).
with(id: '39').and_return([issue])
allow(@project).to receive(:issue_exists?).
with(39).and_return([issue])
actual = 'We'll accept good pull requests.'
expect(gfm(actual)).to eq("We'll accept good pull requests.")
end
......@@ -609,7 +609,7 @@ def url_helper(image_name)
end
it "should leave ref-like href of 'manual' links untouched" do
expect(markdown("why not [inspect !#{merge_request.iid}](http://example.tld/#!#{merge_request.iid})")).to eq("<p>why not <a href=\"http://example.tld/#!#{merge_request.iid}\">inspect </a><a href=\"#{namespace_project_merge_request_path(project.namespace, project, merge_request)}\" title=\"Merge Request: #{merge_request.title}\" class=\"gfm gfm-merge_request \">!#{merge_request.iid}</a><a href=\"http://example.tld/#!#{merge_request.iid}\"></a></p>\n")
expect(markdown("why not [inspect !#{merge_request.iid}](http://example.tld/#!#{merge_request.iid})")).to eq("<p>why not <a href=\"http://example.tld/#!#{merge_request.iid}\">inspect </a><a href=\"#{namespace_project_merge_request_path(project.namespace, project, merge_request)}\" title=\"Merge Request: #{merge_request.title}\" class=\"gfm gfm-merge_request\">!#{merge_request.iid}</a><a href=\"http://example.tld/#!#{merge_request.iid}\"></a></p>\n")
end
it "should leave ref-like src of images untouched" do
......
......@@ -38,6 +38,14 @@ module Gitlab::Markdown
to eq urls.namespace_project_compare_url(project.namespace, project, from: commit1.id, to: commit2.id)
end
it 'links to a valid short ID' do
reference = "#{commit1.short_id}...#{commit2.id}"
reference2 = "#{commit1.id}...#{commit2.short_id}"
expect(filter("See #{reference}").css('a').first.text).to eq reference
expect(filter("See #{reference2}").css('a').first.text).to eq reference2
end
it 'links with adjacent text' do
doc = filter("See (#{reference}.)")
expect(doc.to_html).to match(/\(<a.+>#{Regexp.escape(reference)}<\/a>\.\)/)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment