ActionMailer deliver -> deliver_now
This commit is contained in:
parent
162303db37
commit
290aded7f6
16 changed files with 20 additions and 20 deletions
|
|
@ -13,7 +13,7 @@ class ReportMailer < ActionMailer::Base
|
|||
user = User.find_by_id(person.owner_id)
|
||||
unless user.user_preferences.exists?(:email_type => :someone_reported)
|
||||
resource[:email] = user.email
|
||||
format(resource).deliver
|
||||
format(resource).deliver_now
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ module Workers
|
|||
|
||||
def perform(recipient_id, sender_id, comment_id)
|
||||
if email = Notifier.also_commented(recipient_id, sender_id, comment_id)
|
||||
email.deliver
|
||||
email.deliver_now
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ module Workers
|
|||
sidekiq_options queue: :mail
|
||||
|
||||
def perform(recipient_id, sender_id, comment_id)
|
||||
Notifier.comment_on_post(recipient_id, sender_id, comment_id).deliver
|
||||
Notifier.comment_on_post(recipient_id, sender_id, comment_id).deliver_now
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ module Workers
|
|||
sidekiq_options queue: :mail
|
||||
|
||||
def perform(user_id)
|
||||
Notifier.confirm_email(user_id).deliver
|
||||
Notifier.confirm_email(user_id).deliver_now
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ module Workers
|
|||
sidekiq_options queue: :mail
|
||||
|
||||
def perform(recipient_id, sender_id, like_id)
|
||||
Notifier.liked(recipient_id, sender_id, like_id).deliver
|
||||
Notifier.liked(recipient_id, sender_id, like_id).deliver_now
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ module Workers
|
|||
sidekiq_options queue: :mail
|
||||
|
||||
def perform(recipient_id, actor_id, target_id)
|
||||
Notifier.mentioned( recipient_id, actor_id, target_id).deliver
|
||||
Notifier.mentioned( recipient_id, actor_id, target_id).deliver_now
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ module Workers
|
|||
sidekiq_options queue: :mail
|
||||
|
||||
def perform(recipient_id, actor_id, target_id)
|
||||
Notifier.private_message( recipient_id, actor_id, target_id).deliver
|
||||
Notifier.private_message( recipient_id, actor_id, target_id).deliver_now
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ module Workers
|
|||
sidekiq_options queue: :mail
|
||||
|
||||
def perform(recipient_id, sender_id, reshare_id)
|
||||
Notifier.reshared(recipient_id, sender_id, reshare_id).deliver
|
||||
Notifier.reshared(recipient_id, sender_id, reshare_id).deliver_now
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ module Workers
|
|||
sidekiq_options queue: :mail
|
||||
|
||||
def perform(recipient_id, sender_id, target_id)
|
||||
Notifier.started_sharing(recipient_id, sender_id).deliver
|
||||
Notifier.started_sharing(recipient_id, sender_id).deliver_now
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ module Workers
|
|||
user.flag_for_removal(remove_at)
|
||||
if user.sign_in_count > 0
|
||||
# send a warning
|
||||
Maintenance.account_removal_warning(user).deliver
|
||||
Maintenance.account_removal_warning(user).deliver_now
|
||||
end
|
||||
Workers::RemoveOldUser.perform_in(remove_at+1.day, user.id)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -26,6 +26,6 @@ class EmailInviter
|
|||
private
|
||||
|
||||
def mail(email)
|
||||
Notifier.invite(email, message, inviter, invitation_code, locale).deliver!
|
||||
Notifier.invite(email, message, inviter, invitation_code, locale).deliver_now!
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -13,28 +13,28 @@ describe Maintenance, :type => :mailer do
|
|||
|
||||
it "#should deliver successfully" do
|
||||
expect {
|
||||
Maintenance.account_removal_warning(@user).deliver
|
||||
Maintenance.account_removal_warning(@user).deliver_now
|
||||
}.to_not raise_error
|
||||
end
|
||||
|
||||
it "#should be added to the delivery queue" do
|
||||
expect {
|
||||
Maintenance.account_removal_warning(@user).deliver
|
||||
Maintenance.account_removal_warning(@user).deliver_now
|
||||
}.to change(ActionMailer::Base.deliveries, :size).by(1)
|
||||
end
|
||||
|
||||
it "#should include correct recipient" do
|
||||
Maintenance.account_removal_warning(@user).deliver
|
||||
Maintenance.account_removal_warning(@user).deliver_now
|
||||
expect(ActionMailer::Base.deliveries.last.to[0]).to include(@user.email)
|
||||
end
|
||||
|
||||
it "#should include after inactivity days from settings" do
|
||||
Maintenance.account_removal_warning(@user).deliver
|
||||
Maintenance.account_removal_warning(@user).deliver_now
|
||||
expect(ActionMailer::Base.deliveries.last.body.parts[0].body.raw_source).to include("for #{AppConfig.settings.maintenance.remove_old_users.after_days} days")
|
||||
end
|
||||
|
||||
it "#should include timestamp for account removal" do
|
||||
Maintenance.account_removal_warning(@user).deliver
|
||||
Maintenance.account_removal_warning(@user).deliver_now
|
||||
expect(ActionMailer::Base.deliveries.last.body.parts[0].body.raw_source).to include("sign in to your account before #{@removal_timestamp.utc}")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ describe Notifier, :type => :mailer do
|
|||
let(:comment) { eve.comment!(commented_post, "Totally is")}
|
||||
|
||||
describe ".comment_on_post" do
|
||||
let(:comment_mail) {Notifier.comment_on_post(bob.id, person.id, comment.id).deliver}
|
||||
let(:comment_mail) {Notifier.comment_on_post(bob.id, person.id, comment.id).deliver_now}
|
||||
|
||||
it 'TO: goes to the right person' do
|
||||
expect(comment_mail.to).to eq([bob.email])
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ describe Workers::Mail::Mentioned do
|
|||
m = Mention.new(:person => user.person, :post=> sm)
|
||||
|
||||
mail_double = double()
|
||||
expect(mail_double).to receive(:deliver)
|
||||
expect(mail_double).to receive(:deliver_now)
|
||||
expect(Notifier).to receive(:mentioned).with(user.id, sm.author.id, m.id).and_return(mail_double)
|
||||
|
||||
Workers::Mail::Mentioned.new.perform(user.id, sm.author.id, m.id)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ describe Workers::Mail::PrivateMessage do
|
|||
message = cnv.messages.first
|
||||
|
||||
mail_double = double()
|
||||
expect(mail_double).to receive(:deliver)
|
||||
expect(mail_double).to receive(:deliver_now)
|
||||
expect(Notifier).to receive(:mentioned).with(user2.id, user1.person.id, message.id).and_return(mail_double)
|
||||
|
||||
Workers::Mail::Mentioned.new.perform(user2.id, user1.person.id, message.id)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ describe Workers::Mail::Reshared do
|
|||
reshare = FactoryGirl.build(:reshare, :author => alice.person, :root=> sm)
|
||||
|
||||
mail_double = double()
|
||||
expect(mail_double).to receive(:deliver)
|
||||
expect(mail_double).to receive(:deliver_now)
|
||||
expect(Notifier).to receive(:reshared).with(bob.id, reshare.author.id, reshare.id).and_return(mail_double)
|
||||
|
||||
Workers::Mail::Reshared.new.perform(bob.id, reshare.author.id, reshare.id)
|
||||
|
|
|
|||
Loading…
Reference in a new issue