summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorAlexandru Croitor <acroitor@gitlab.com>2019-07-05 18:45:07 +0300
committerAlexandru Croitor <acroitor@gitlab.com>2019-07-12 12:29:04 +0300
commit435be1442f03372f42c368efdd8bf941a577e7b6 (patch)
treeb5703cc1ea710d23871bd33950ae219e1bc85116 /spec
parent1def071991dddf6a1500c84d9e53a0edd64d45a1 (diff)
downloadgitlab-ce-435be1442f03372f42c368efdd8bf941a577e7b6.tar.gz
Fix reply to discussion on promoted epic11445-fix-promoted-epic-inherited-discussions-ce
Regenerate discussion_id for notes that are being copied over to the epic when issue is promoted to epic. https://gitlab.com/gitlab-org/gitlab-ee/issues/11445
Diffstat (limited to 'spec')
-rw-r--r--spec/services/issuable/clone/content_rewriter_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/services/issuable/clone/content_rewriter_spec.rb b/spec/services/issuable/clone/content_rewriter_spec.rb
index 230e1123280..3479c20862a 100644
--- a/spec/services/issuable/clone/content_rewriter_spec.rb
+++ b/spec/services/issuable/clone/content_rewriter_spec.rb
@@ -165,5 +165,18 @@ describe Issuable::Clone::ContentRewriter do
expect(note.note_html).not_to eq(new_note.note_html)
end
end
+
+ context "discussion notes" do
+ let(:note) { create(:note, noteable: original_issue, note: "sample note", project: project1) }
+ let!(:discussion) { create(:discussion_note_on_issue, in_reply_to: note, note: "reply to sample note") }
+
+ it 'rewrites discussion correctly' do
+ subject.execute
+
+ expect(new_issue.notes.count).to eq(original_issue.notes.count)
+ expect(new_issue.notes.where(discussion_id: discussion.discussion_id).count).to eq(0)
+ expect(original_issue.notes.where(discussion_id: discussion.discussion_id).count).to eq(1)
+ end
+ end
end
end