Commit ca6196698d79b96986d55e8ef5f66a51783f5d0b

Authored by Tallys Martins
Committed by Gabriel Silva
1 parent 09ba5847

Adds reject explanation to add member task

Signed-off-by: Tallys Martins <tallysmartins@gmail.com>
Signed-off-by: Gabriel Silva <gabriel93.silva@gmail.com>
app/models/add_member.rb
... ... @@ -37,6 +37,10 @@ class AddMember &lt; Task
37 37 true
38 38 end
39 39  
  40 + def reject_details
  41 + true
  42 + end
  43 +
40 44 def footer
41 45 true
42 46 end
... ... @@ -72,8 +76,9 @@ class AddMember &lt; Task
72 76 end
73 77  
74 78 def task_cancelled_message
75   - _("Your request to enter community \"%{target} with the profile \"%{requestor}\" was not accepted. Please contact any profile admin from %{url} for more information.") %
  79 + _("Your request to enter community \"%{target} with the profile \"%{requestor}\" was not accepted. Please contact any profile admin from %{url} for more information. The following explanation was given: \n\n\"%{explanation}\"") %
76 80 {:target => self.target.name, :url => self.target.url,
77   - :requestor => self.requestor.name}
  81 + :requestor => self.requestor.name,
  82 + :explanation => self.reject_explanation}
78 83 end
79 84 end
... ...
test/unit/add_member_test.rb
... ... @@ -149,4 +149,11 @@ class AddMemberTest &lt; ActiveSupport::TestCase
149 149  
150 150 assert_no_match(/\(#{task.requestor.email}\)/, task.target_notification_description)
151 151 end
  152 +
  153 + should 'have cancel notification message with explanation' do
  154 + explanation_message = 'some explanation'
  155 + task = AddMember.new(:person => person, :organization => community,
  156 + :reject_explanation => explanation_message)
  157 + assert_match(/#{explanation_message}/, task.task_cancelled_message)
  158 + end
152 159 end
... ...