summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2019-05-27 12:47:49 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2019-05-27 12:47:49 +0000
commitae1d81661d6b0d609cea0d5e3d0e8af547e33ead (patch)
tree52e0ff5eaff8605ecb5b46765a8b78a223a334c0 /spec
parent545e48310c66f1bc8cec91ca83ca827a51e35ced (diff)
parent96d8f009bc762b94e66fa96e5a38f3e3ee2faeb0 (diff)
downloadgitlab-ce-ae1d81661d6b0d609cea0d5e3d0e8af547e33ead.tar.gz
Merge branch '57825-moving-an-issue-results-in-broken-image-links-in-comments' into 'master'
Resolve "Moving an issue results in broken image links in comments" Closes #57825 See merge request gitlab-org/gitlab-ce!28654
Diffstat (limited to 'spec')
-rw-r--r--spec/services/issuable/clone/content_rewriter_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/services/issuable/clone/content_rewriter_spec.rb b/spec/services/issuable/clone/content_rewriter_spec.rb
index 4d3cb0bd254..230e1123280 100644
--- a/spec/services/issuable/clone/content_rewriter_spec.rb
+++ b/spec/services/issuable/clone/content_rewriter_spec.rb
@@ -149,5 +149,21 @@ describe Issuable::Clone::ContentRewriter do
expect(new_note.author).to eq(note.author)
end
end
+
+ context 'notes with upload' do
+ let(:uploader) { build(:file_uploader, project: project1) }
+ let(:text) { "Simple text with image: #{uploader.markdown_link} "}
+ let!(:note) { create(:note, noteable: original_issue, note: text, project: project1) }
+
+ it 'rewrites note content correctly' do
+ subject.execute
+ new_note = new_issue.notes.first
+
+ expect(note.note).to match(/Simple text with image: #{FileUploader::MARKDOWN_PATTERN}/)
+ expect(new_note.note).to match(/Simple text with image: #{FileUploader::MARKDOWN_PATTERN}/)
+ expect(note.note).not_to eq(new_note.note)
+ expect(note.note_html).not_to eq(new_note.note_html)
+ end
+ end
end
end