From 8b9f29ca8463c78634aabc3649f48f3b86f32410 Mon Sep 17 00:00:00 2001 From: Luciano Prestes Cavalcanti Date: Thu, 8 Oct 2015 16:33:34 +0200 Subject: [PATCH] Fix and add tests for show requestor email on AddMember task --- test/unit/add_member_test.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/unit/add_member_test.rb b/test/unit/add_member_test.rb index 27e29ca..ef1fc3e 100644 --- a/test/unit/add_member_test.rb +++ b/test/unit/add_member_test.rb @@ -121,12 +121,21 @@ class AddMemberTest < ActiveSupport::TestCase assert_match(/#{task.requestor.name} wants to be a member of '#{community.name}'/, email.subject) end - should 'have target notification description with requestor email' do + should 'notification description with requestor email if requestor email is public' do new_person = create_user('testuser').person new_person.update_attributes!({:fields_privacy => {:email => 'public'}}) task = AddMember.new(:person => new_person, :organization => community) - assert_match(/#{task.requestor.name} \(#{task.requestor.email}\) wants to be a member of '#{community.name}'./, task.target_notification_description) + assert_match(/\(#{task.requestor.email}\)/, task.target_notification_description) + end + + should 'notification description without requestor email if requestor email is not public' do + new_person = create_user('testuser').person + new_person.update_attributes!({:fields_privacy => {:email => '0'}}) + + task = AddMember.new(:person => new_person, :organization => community) + + assert_not_match(/\(#{task.requestor.email}\)/, task.target_notification_description) end end -- libgit2 0.21.2