diff --git a/app/mailers/notifier.rb b/app/mailers/notifier.rb index 73f42a446..61c5c0c49 100644 --- a/app/mailers/notifier.rb +++ b/app/mailers/notifier.rb @@ -9,10 +9,10 @@ class Notifier < ActionMailer::Base recipients.each do |rec| mail = single_admin(string, rec) mails << mail - mail.deliver end mails end + def single_admin(string, recipient) @recipient = recipient @string = string.html_safe diff --git a/spec/mailers/notifier_spec.rb b/spec/mailers/notifier_spec.rb index 7d335d9ff..e5c7cd1b0 100644 --- a/spec/mailers/notifier_spec.rb +++ b/spec/mailers/notifier_spec.rb @@ -13,7 +13,7 @@ describe Notifier do it 'mails a user' do mails = Notifier.admin("Welcome to bureaucracy!", [user]) mails.length.should == 1 - mail = Notifier.deliveries.first + mail = mails.first mail.to.should == [user.email] mail.body.encoded.should match /Welcome to bureaucracy!/ mail.body.encoded.should match /#{user.username}/ @@ -23,8 +23,7 @@ describe Notifier do 5.times do users << make_user end - Notifier.admin("Welcome to bureaucracy!", users) - mails = Notifier.deliveries + mails = Notifier.admin("Welcome to bureaucracy!", users) mails.length.should == 5 mails.each{|mail| this_user = users.detect{|u| mail.to == [u.email]}