Add ExportRecurringDonationsFailedJob

This commit is contained in:
Eric Schultz 2019-11-07 13:12:04 -06:00
parent e9a01c76ef
commit b6e11124de
4 changed files with 8 additions and 32 deletions

View file

@ -0,0 +1,7 @@
class ExportRecurringDonationsFailedJob < ApplicationJob
queue_as :default
def perform(export)
ExportMailer.export_recurring_donations_failed_notification(export).deliver_now
end
end

View file

@ -69,7 +69,7 @@ module ExportRecurringDonations
export.ended = Time.now export.ended = Time.now
export.save! export.save!
if user if user
ExportMailer.delay.export_recurring_donations_failed_notification(export) ExportRecurringDonationsFailedJob.perform_later(export)
end end
raise e raise e
end end

View file

@ -1,16 +0,0 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
module JobTypes
class ExportRecurringDonationsFailedJob < EmailJob
attr_reader :export
def initialize(export)
@export = export
end
def perform
ExportMailer.export_recurring_donations_failed_notification(@export).deliver
end
end
end

View file

@ -1,15 +0,0 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
require 'rails_helper.rb'
describe JobTypes::ExportRecurringDonationsFailedJob do
describe '.perform' do
it 'calls the correct active mailer' do
expect(ExportMailer).to receive(:export_recurring_donations_failed_notification).with(1).and_wrap_original { |_m, *_args| mailer = double('object'); expect(mailer).to receive(:deliver).and_return(nil); mailer }
job = JobTypes::ExportRecurringDonationsFailedJob.new(1)
job.perform
end
end
end