diff options
author | Rémy Coutable <remy@rymai.me> | 2017-08-04 19:14:04 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-01-31 18:31:21 +0100 |
commit | a2718ebaffd431b1eec91f3ee467d9632309b5f2 (patch) | |
tree | cb9953a334be6f4e026d1ed35ef57130b731d7e3 /spec/services/notification_service_spec.rb | |
parent | 9c34c023808b38303d4988a20f62645c552951e3 (diff) | |
download | gitlab-ce-a2718ebaffd431b1eec91f3ee467d9632309b5f2.tar.gz |
Make user/author use project.creator in most factories
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/services/notification_service_spec.rb')
-rw-r--r-- | spec/services/notification_service_spec.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb index 5c59455e3e1..35eb84e5e88 100644 --- a/spec/services/notification_service_spec.rb +++ b/spec/services/notification_service_spec.rb @@ -458,7 +458,7 @@ describe NotificationService, :mailer do context "merge request diff note" do let(:project) { create(:project, :repository) } let(:user) { create(:user) } - let(:merge_request) { create(:merge_request, source_project: project, assignee: user) } + let(:merge_request) { create(:merge_request, source_project: project, assignee: user, author: create(:user)) } let(:note) { create(:diff_note_on_merge_request, project: project, noteable: merge_request) } before do @@ -469,11 +469,13 @@ describe NotificationService, :mailer do describe '#new_note' do it "records sent notifications" do - # Ensure create SentNotification by noteable = merge_request 6 times, not noteable = note + # 3 SentNotification are sent: the MR assignee and author, and the @u_watcher expect(SentNotification).to receive(:record_note).with(note, any_args).exactly(3).times.and_call_original notification.new_note(note) + expect(SentNotification.last(3).map(&:recipient).map(&:id)) + .to contain_exactly(merge_request.assignee.id, merge_request.author.id, @u_watcher.id) expect(SentNotification.last.in_reply_to_discussion_id).to eq(note.discussion_id) end end |