summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorOswaldo Ferreira <oswaldo@gitlab.com>2018-02-26 12:28:49 -0300
committerOswaldo Ferreira <oswaldo@gitlab.com>2018-02-27 10:32:50 -0300
commitffb107ac7d8ba17ecd4d10ef1d8a94d5c62630b2 (patch)
tree4acc4d2b5b4edd11fbdd83f81455496b9efa614c /spec/lib
parent565e4ee5a6566057ee524963565f045bd1b2c51a (diff)
downloadgitlab-ce-ffb107ac7d8ba17ecd4d10ef1d8a94d5c62630b2.tar.gz
Keep link when redacting unauthorized object links
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/banzai/redactor_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/lib/banzai/redactor_spec.rb b/spec/lib/banzai/redactor_spec.rb
index 1fa89137972..441f3725985 100644
--- a/spec/lib/banzai/redactor_spec.rb
+++ b/spec/lib/banzai/redactor_spec.rb
@@ -40,6 +40,16 @@ describe Banzai::Redactor do
expect(doc.to_html).to eq(original_content)
end
end
+
+ it 'returns <a> tag with original href if it is originally a link reference' do
+ href = 'http://localhost:3000'
+ doc = Nokogiri::HTML
+ .fragment("<a class='gfm' data-reference-type='issue' data-original=#{href} data-link-reference='true'>#{href}</a>")
+
+ redactor.redact([doc])
+
+ expect(doc.to_html).to eq('<a href="http://localhost:3000">http://localhost:3000</a>')
+ end
end
context 'when project is in pending delete' do