diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-02-27 18:29:04 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-02-27 18:29:04 +0300 |
commit | 7d12f3a84e39c6be6f3798e37b39f0023ece71ec (patch) | |
tree | 93a1454c371a25a545acca6c488c13937e3a50ff /spec | |
parent | 3bf448267b117e79f08ab2f4b769d24a705a5f0f (diff) | |
parent | ffb107ac7d8ba17ecd4d10ef1d8a94d5c62630b2 (diff) |
Merge branch '40502-osw-keep-link-when-redacting-unauthorized-objects' into 'master'
Keep raw link when redacting unauthorized link object references
Closes #40502
See merge request gitlab-org/gitlab-ce!17365
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/banzai/redactor_spec.rb | 10 |
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 |