Commit 8ac3abc12deb1ada1a1687a677cb85dd3b0ad25b
1 parent
a4d115e7
Exists in
master
and in
21 other branches
Fix and add tests for show requestor email on AddMember task
Showing
1 changed file
with
11 additions
and
2 deletions
Show diff stats
test/unit/add_member_test.rb
| ... | ... | @@ -121,12 +121,21 @@ class AddMemberTest < ActiveSupport::TestCase |
| 121 | 121 | assert_match(/#{task.requestor.name} wants to be a member of '#{community.name}'/, email.subject) |
| 122 | 122 | end |
| 123 | 123 | |
| 124 | - should 'have target notification description with requestor email' do | |
| 124 | + should 'notification description with requestor email if requestor email is public' do | |
| 125 | 125 | new_person = create_user('testuser').person |
| 126 | 126 | new_person.update_attributes!({:fields_privacy => {:email => 'public'}}) |
| 127 | 127 | |
| 128 | 128 | task = AddMember.new(:person => new_person, :organization => community) |
| 129 | 129 | |
| 130 | - assert_match(/#{task.requestor.name} \(#{task.requestor.email}\) wants to be a member of '#{community.name}'./, task.target_notification_description) | |
| 130 | + assert_match(/\(#{task.requestor.email}\)/, task.target_notification_description) | |
| 131 | + end | |
| 132 | + | |
| 133 | + should 'notification description without requestor email if requestor email is not public' do | |
| 134 | + new_person = create_user('testuser').person | |
| 135 | + new_person.update_attributes!({:fields_privacy => {:email => '0'}}) | |
| 136 | + | |
| 137 | + task = AddMember.new(:person => new_person, :organization => community) | |
| 138 | + | |
| 139 | + assert_not_match(/\(#{task.requestor.email}\)/, task.target_notification_description) | |
| 131 | 140 | end |
| 132 | 141 | end | ... | ... |