diff options
author | Heinrich Lee Yu <heinrich@gitlab.com> | 2019-02-06 13:31:46 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2019-02-06 13:31:46 +0300 |
commit | a04d9ba90c0d1df02f613b7aa01ef598e1ac5b28 (patch) | |
tree | 4a8889592e2290160926ede70aa0cf37bd93519f /spec/lib/gitlab/email | |
parent | c5f1b8346860aa764369a3d156047c9e2c7317ca (diff) |
Add reply to notes to turn into discussions
Diffstat (limited to 'spec/lib/gitlab/email')
-rw-r--r-- | spec/lib/gitlab/email/handler/create_note_handler_spec.rb | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/spec/lib/gitlab/email/handler/create_note_handler_spec.rb b/spec/lib/gitlab/email/handler/create_note_handler_spec.rb index e5420ea6bea..50e473c459e 100644 --- a/spec/lib/gitlab/email/handler/create_note_handler_spec.rb +++ b/spec/lib/gitlab/email/handler/create_note_handler_spec.rb @@ -155,11 +155,7 @@ describe Gitlab::Email::Handler::CreateNoteHandler do it_behaves_like "checks permissions on noteable" end - context "when everything is fine" do - before do - setup_attachment - end - + shared_examples 'a reply to existing comment' do it "creates a comment" do expect { receiver.execute }.to change { noteable.notes.count }.by(1) new_note = noteable.notes.last @@ -168,7 +164,21 @@ describe Gitlab::Email::Handler::CreateNoteHandler do expect(new_note.position).to eq(note.position) expect(new_note.note).to include("I could not disagree more.") expect(new_note.in_reply_to?(note)).to be_truthy + + if note.part_of_discussion? + expect(new_note.discussion_id).to eq(note.discussion_id) + else + expect(new_note.discussion_id).not_to eq(note.discussion_id) + end end + end + + context "when everything is fine" do + before do + setup_attachment + end + + it_behaves_like 'a reply to existing comment' it "adds all attachments" do receiver.execute @@ -207,4 +217,10 @@ describe Gitlab::Email::Handler::CreateNoteHandler do end end end + + context "when note is not a discussion" do + let(:note) { create(:note_on_merge_request, project: project) } + + it_behaves_like 'a reply to existing comment' + end end |