Commit 65989141 authored by Robb Kidd's avatar Robb Kidd
Browse files

Protect IssueObserver#send_reassigned_email method.

parent 1180c79ef944
...@@ -11,6 +11,8 @@ def after_update(issue) ...@@ -11,6 +11,8 @@ def after_update(issue)
Note.create_status_change_note(issue, current_user, 'reopened') if issue.is_being_reopened? Note.create_status_change_note(issue, current_user, 'reopened') if issue.is_being_reopened?
end end
protected
def send_reassigned_email(issue) def send_reassigned_email(issue)
recipient_ids = [issue.assignee_id, issue.assignee_id_was].keep_if {|id| id != current_user.id } recipient_ids = [issue.assignee_id, issue.assignee_id_was].keep_if {|id| id != current_user.id }
......
...@@ -121,7 +121,7 @@ def it_does_not_send_a_reassigned_email_to(recipient) ...@@ -121,7 +121,7 @@ def it_does_not_send_a_reassigned_email_to(recipient)
it_sends_a_reassigned_email_to assignee.id it_sends_a_reassigned_email_to assignee.id
it_sends_a_reassigned_email_to previous_assignee.id it_sends_a_reassigned_email_to previous_assignee.id
subject.send_reassigned_email(issue) subject.send(:send_reassigned_email, issue)
end end
context 'does not send an email to the user who made the reassignment' do context 'does not send an email to the user who made the reassignment' do
...@@ -130,14 +130,14 @@ def it_does_not_send_a_reassigned_email_to(recipient) ...@@ -130,14 +130,14 @@ def it_does_not_send_a_reassigned_email_to(recipient)
it_sends_a_reassigned_email_to previous_assignee.id it_sends_a_reassigned_email_to previous_assignee.id
it_does_not_send_a_reassigned_email_to assignee.id it_does_not_send_a_reassigned_email_to assignee.id
subject.send_reassigned_email(issue) subject.send(:send_reassigned_email, issue)
end end
it 'if the user is the previous assignee' do it 'if the user is the previous assignee' do
subject.stub(:current_user).and_return(previous_assignee) subject.stub(:current_user).and_return(previous_assignee)
it_sends_a_reassigned_email_to assignee.id it_sends_a_reassigned_email_to assignee.id
it_does_not_send_a_reassigned_email_to previous_assignee.id it_does_not_send_a_reassigned_email_to previous_assignee.id
subject.send_reassigned_email(issue) subject.send(:send_reassigned_email, issue)
end end
end end
end end
......
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