Commit 16068f3b authored by Marin Jankovski's avatar Marin Jankovski

Test if reopen notifications are sent.

parent 310231db
...@@ -49,7 +49,6 @@ module Emails ...@@ -49,7 +49,6 @@ module Emails
@updated_by = User.find updated_by_user_id @updated_by = User.find updated_by_user_id
@target_url = project_merge_request_url(@project, @merge_request) @target_url = project_merge_request_url(@project, @merge_request)
set_reference("merge_request_#{merge_request_id}") set_reference("merge_request_#{merge_request_id}")
mail(from: sender(updated_by_user_id), mail(from: sender(updated_by_user_id),
to: recipient(recipient_id), to: recipient(recipient_id),
subject: subject("#{@merge_request.title} (##{@merge_request.iid}) #{@mr_status}")) subject: subject("#{@merge_request.title} (##{@merge_request.iid}) #{@mr_status}"))
......
...@@ -242,6 +242,26 @@ describe NotificationService do ...@@ -242,6 +242,26 @@ describe NotificationService do
Notify.should_not_receive(:closed_issue_email).with(user_id, issue.id, @u_disabled.id) Notify.should_not_receive(:closed_issue_email).with(user_id, issue.id, @u_disabled.id)
end end
end end
describe :reopen_issue do
it 'should send email to issue assignee and issue author' do
should_email(issue.assignee_id)
should_email(issue.author_id)
should_email(@u_watcher.id)
should_not_email(@u_participating.id)
should_not_email(@u_disabled.id)
notification.reopen_issue(issue, @u_disabled)
end
def should_email(user_id)
Notify.should_receive(:issue_status_changed_email).with(user_id, issue.id, 'reopened', @u_disabled.id)
end
def should_not_email(user_id)
Notify.should_not_receive(:issue_status_changed_email).with(user_id, issue.id, 'reopened', @u_disabled.id)
end
end
end end
describe 'Merge Requests' do describe 'Merge Requests' do
...@@ -322,6 +342,24 @@ describe NotificationService do ...@@ -322,6 +342,24 @@ describe NotificationService do
Notify.should_not_receive(:merged_merge_request_email).with(user_id, merge_request.id, @u_disabled.id) Notify.should_not_receive(:merged_merge_request_email).with(user_id, merge_request.id, @u_disabled.id)
end end
end end
describe :reopen_merge_request do
it do
should_email(merge_request.assignee_id)
should_email(@u_watcher.id)
should_not_email(@u_participating.id)
should_not_email(@u_disabled.id)
notification.reopen_mr(merge_request, @u_disabled)
end
def should_email(user_id)
Notify.should_receive(:merge_request_status_email).with(user_id, merge_request.id, 'reopened', @u_disabled.id)
end
def should_not_email(user_id)
Notify.should_not_receive(:merge_request_status_email).with(user_id, merge_request.id, 'reopened', @u_disabled.id)
end
end
end end
describe 'Projects' do describe 'Projects' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment