diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-21 12:06:16 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-21 12:06:16 +0300 |
commit | a048261403ea7e12992ccffe704f0779235712d7 (patch) | |
tree | 59254549db6d39a4da824379a7bf354e7c8e7e67 /spec/mailers | |
parent | 80e5134020483299c039114e76b734436f006c66 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/mailers')
-rw-r--r-- | spec/mailers/notify_spec.rb | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index df82ac38fc6..ad256c10964 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -990,7 +990,8 @@ describe Notify do end context 'when a comment on an existing discussion' do - let!(:second_note) { create(model, author: note_author, noteable: nil, in_reply_to: note) } + let(:first_note) { create_note } + let(:note) { create(model, author: note_author, noteable: nil, in_reply_to: first_note) } it 'contains an introduction' do is_expected.to have_body_text 'commented on a' @@ -1000,7 +1001,11 @@ describe Notify do describe 'on a commit' do let(:commit) { project.commit } - let(:note) { create(:discussion_note_on_commit, commit_id: commit.id, project: project, author: note_author) } + let(:note) { create_note } + + def create_note + create(:discussion_note_on_commit, commit_id: commit.id, project: project, author: note_author) + end before do allow(note).to receive(:noteable).and_return(commit) @@ -1027,9 +1032,13 @@ describe Notify do end describe 'on a merge request' do - let(:note) { create(:discussion_note_on_merge_request, noteable: merge_request, project: project, author: note_author) } + let(:note) { create_note } let(:note_on_merge_request_path) { project_merge_request_path(project, merge_request, anchor: "note_#{note.id}") } + def create_note + create(:discussion_note_on_merge_request, noteable: merge_request, project: project, author: note_author) + end + before do allow(note).to receive(:noteable).and_return(merge_request) end @@ -1055,9 +1064,13 @@ describe Notify do end describe 'on an issue' do - let(:note) { create(:discussion_note_on_issue, noteable: issue, project: project, author: note_author) } + let(:note) { create_note } let(:note_on_issue_path) { project_issue_path(project, issue, anchor: "note_#{note.id}") } + def create_note + create(:discussion_note_on_issue, noteable: issue, project: project, author: note_author) + end + before do allow(note).to receive(:noteable).and_return(issue) end @@ -1134,7 +1147,8 @@ describe Notify do end context 'when a comment on an existing discussion' do - let!(:second_note) { create(model, author: note_author, noteable: nil, in_reply_to: note) } + let(:first_note) { create(model) } + let(:note) { create(model, author: note_author, noteable: nil, in_reply_to: first_note) } it 'contains an introduction' do is_expected.to have_body_text 'commented on a discussion on' |