diff options
author | egrieff <egrieff@gitlab.com> | 2019-05-23 16:12:41 +0300 |
---|---|---|
committer | egrieff <egrieff@gitlab.com> | 2019-05-23 16:12:41 +0300 |
commit | ec7821d8d130bbc9f06e9b3112b2dfc4fe980d37 (patch) | |
tree | 75c0e6187109622cd42a0654bf464af29bb555bd /spec | |
parent | ae1bc2fd35dc791f17db2594411e41ebcb55f43a (diff) |
Test that upload links are rewritten for new notes
Diffstat (limited to 'spec')
-rw-r--r-- | spec/services/issuable/clone/content_rewriter_spec.rb | 16 |
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..92292528cc3 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 uploads' 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 correclty' 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 |