From 65989141dcc58eaa3cecfe98bc97a10075cf4f7e Mon Sep 17 00:00:00 2001 From: Robb Kidd Date: Wed, 20 Jun 2012 21:23:05 -0400 Subject: [PATCH] Protect IssueObserver#send_reassigned_email method. --- app/models/issue_observer.rb | 2 ++ spec/models/issue_observer_spec.rb | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/models/issue_observer.rb b/app/models/issue_observer.rb index a1f9fade..fadedd30 100644 --- a/app/models/issue_observer.rb +++ b/app/models/issue_observer.rb @@ -11,6 +11,8 @@ class IssueObserver < ActiveRecord::Observer Note.create_status_change_note(issue, current_user, 'reopened') if issue.is_being_reopened? end + protected + def send_reassigned_email(issue) recipient_ids = [issue.assignee_id, issue.assignee_id_was].keep_if {|id| id != current_user.id } diff --git a/spec/models/issue_observer_spec.rb b/spec/models/issue_observer_spec.rb index 8270d3db..2b9798f7 100644 --- a/spec/models/issue_observer_spec.rb +++ b/spec/models/issue_observer_spec.rb @@ -121,7 +121,7 @@ describe IssueObserver do it_sends_a_reassigned_email_to assignee.id it_sends_a_reassigned_email_to previous_assignee.id - subject.send_reassigned_email(issue) + subject.send(:send_reassigned_email, issue) end context 'does not send an email to the user who made the reassignment' do @@ -130,14 +130,14 @@ describe IssueObserver do it_sends_a_reassigned_email_to previous_assignee.id it_does_not_send_a_reassigned_email_to assignee.id - subject.send_reassigned_email(issue) + subject.send(:send_reassigned_email, issue) end it 'if the user is the previous assignee' do subject.stub(:current_user).and_return(previous_assignee) it_sends_a_reassigned_email_to 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