Commit 0ceb4036c5fa8c32f4b36b2486827401ddcc3156

Authored by Rodrigo Souto
1 parent d948f581

rails3: fix mailer deliver

test/unit/create_community_test.rb
@@ -98,7 +98,7 @@ class CreateCommunityTest < ActiveSupport::TestCase @@ -98,7 +98,7 @@ class CreateCommunityTest < ActiveSupport::TestCase
98 should 'deliver target notification message' do 98 should 'deliver target notification message' do
99 task = CreateCommunity.new(:name => 'community test', :target => Environment.default, :requestor => person) 99 task = CreateCommunity.new(:name => 'community test', :target => Environment.default, :requestor => person)
100 100
101 - email = TaskMailer.deliver_target_notification(task, task.target_notification_message) 101 + email = TaskMailer.target_notification(task, task.target_notification_message).deliver
102 assert_match(/#{task.requestor.name} wants to create community #{task.subject}/, email.subject) 102 assert_match(/#{task.requestor.name} wants to create community #{task.subject}/, email.subject)
103 end 103 end
104 104
test/unit/invite_member_test.rb
@@ -88,10 +88,10 @@ class InviteMemberTest < ActiveSupport::TestCase @@ -88,10 +88,10 @@ class InviteMemberTest < ActiveSupport::TestCase
88 should 'not invite yourself' do 88 should 'not invite yourself' do
89 p = create_user('testuser1').person 89 p = create_user('testuser1').person
90 90
91 - task1 = InviteMember.new(:person => p, :friend => p, :message => 'click here: <url>') 91 + task1 = build(InviteMember, :person => p, :friend => p, :message => 'click here: <url>')
92 assert !task1.save 92 assert !task1.save
93 93
94 - task2 = InviteMember.new(:person => p, :friend_name => 'Myself', :friend_email => p.user.email, :message => 'click here: <url>') 94 + task2 = build(InviteMember, :person => p, :friend_name => 'Myself', :friend_email => p.user.email, :message => 'click here: <url>')
95 assert !task2.save 95 assert !task2.save
96 end 96 end
97 97
@@ -99,7 +99,7 @@ class InviteMemberTest &lt; ActiveSupport::TestCase @@ -99,7 +99,7 @@ class InviteMemberTest &lt; ActiveSupport::TestCase
99 p = create_user('testuser1').person 99 p = create_user('testuser1').person
100 community = fast_create(Community) 100 community = fast_create(Community)
101 101
102 - task = InviteMember.create!(:person => p, :friend_email => 'test@test.com', :message => '<url>', :community_id => community.id) 102 + task = create(InviteMember, :person => p, :friend_email => 'test@test.com', :message => '<url>', :community_id => community.id)
103 103
104 assert_match(/#{task.requestor.name} invited you to join #{community.name}/, task.target_notification_description) 104 assert_match(/#{task.requestor.name} invited you to join #{community.name}/, task.target_notification_description)
105 end 105 end
@@ -108,9 +108,9 @@ class InviteMemberTest &lt; ActiveSupport::TestCase @@ -108,9 +108,9 @@ class InviteMemberTest &lt; ActiveSupport::TestCase
108 person = create_user('testuser1').person 108 person = create_user('testuser1').person
109 community = fast_create(Community) 109 community = fast_create(Community)
110 110
111 - task = InviteMember.create!(:person => person, :friend_email => 'test@test.com', :message => '<url>', :community_id => community.id) 111 + task = create(InviteMember, :person => person, :friend_email => 'test@test.com', :message => '<url>', :community_id => community.id)
112 112
113 - email = TaskMailer.deliver_invitation_notification(task) 113 + email = TaskMailer.invitation_notification(task).deliver
114 114
115 assert_match(/#{task.requestor.name} invited you to join #{community.name}/, email.subject) 115 assert_match(/#{task.requestor.name} invited you to join #{community.name}/, email.subject)
116 end 116 end
test/unit/suggest_article_test.rb
@@ -145,7 +145,7 @@ class SuggestArticleTest &lt; ActiveSupport::TestCase @@ -145,7 +145,7 @@ class SuggestArticleTest &lt; ActiveSupport::TestCase
145 should 'deliver target notification message' do 145 should 'deliver target notification message' do
146 task = build(SuggestArticle, :target => @profile, :article_name => 'suggested article', :name => 'johndoe', :email => 'johndoe@example.com') 146 task = build(SuggestArticle, :target => @profile, :article_name => 'suggested article', :name => 'johndoe', :email => 'johndoe@example.com')
147 147
148 - email = TaskMailer.deliver_target_notification(task, task.target_notification_message) 148 + email = TaskMailer.target_notification(task, task.target_notification_message).deliver
149 149
150 assert_match(/#{task.name}.*suggested the publication of the article: #{task.subject}/, email.subject) 150 assert_match(/#{task.name}.*suggested the publication of the article: #{task.subject}/, email.subject)
151 end 151 end