diff --git a/app/jobs/recurring_donation_change_amount_nonprofit_email_job.rb b/app/jobs/recurring_donation_change_amount_nonprofit_email_job.rb index 1250b63e..27f2fb56 100644 --- a/app/jobs/recurring_donation_change_amount_nonprofit_email_job.rb +++ b/app/jobs/recurring_donation_change_amount_nonprofit_email_job.rb @@ -1,7 +1,7 @@ class RecurringDonationChangeAmountNonprofitEmailJob < ApplicationJob queue_as :default - def perform(*args) - # Do something later + def perform(recurring_donation, previous_amount) + DonationMailer.nonprofit_recurring_donation_change_amount(recurring_donation.id, previous_amount).deliver_now end end diff --git a/lib/job_types/nonprofit_recurring_donation_change_amount_job.rb b/lib/job_types/nonprofit_recurring_donation_change_amount_job.rb deleted file mode 100644 index 35528a93..00000000 --- a/lib/job_types/nonprofit_recurring_donation_change_amount_job.rb +++ /dev/null @@ -1,17 +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 NonprofitRecurringDonationChangeAmountJob < EmailJob - attr_reader :donation_id, :previous_amount - - def initialize(donation_id, previous_amount = nil) - @donation_id = donation_id - @previous_amount = previous_amount - end - - def perform - DonationMailer.nonprofit_recurring_donation_change_amount(@donation_id, @previous_amount).deliver - end - end -end diff --git a/lib/update/update_recurring_donations.rb b/lib/update/update_recurring_donations.rb index 13aa6511..c5932a3e 100644 --- a/lib/update/update_recurring_donations.rb +++ b/lib/update/update_recurring_donations.rb @@ -74,7 +74,6 @@ module UpdateRecurringDonations donation.save! end RecurringDonationChangeAmountJob.perform_later(rd, previous_amount) - EmailJobQueue.queue(JobTypes::NonprofitRecurringDonationChangeAmountJob, rd.id, previous_amount) rd end diff --git a/spec/lib/job_types/nonprofit_recurring_donation_change_amount_job_spec.rb b/spec/lib/job_types/nonprofit_recurring_donation_change_amount_job_spec.rb deleted file mode 100644 index c0d9fb1f..00000000 --- a/spec/lib/job_types/nonprofit_recurring_donation_change_amount_job_spec.rb +++ /dev/null @@ -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::NonprofitRecurringDonationChangeAmountJob do - describe '.perform' do - it 'calls the correct active mailer' do - expect(DonationMailer).to receive(:nonprofit_recurring_donation_change_amount).with(1, 100).and_wrap_original { |_m, *_args| mailer = double('object'); expect(mailer).to receive(:deliver).and_return(nil); mailer } - - job = JobTypes::NonprofitRecurringDonationChangeAmountJob.new(1, 100) - job.perform - end - end -end diff --git a/spec/lib/update/update_recurring_donations_spec.rb b/spec/lib/update/update_recurring_donations_spec.rb index a79fbee8..2b2ad24c 100644 --- a/spec/lib/update/update_recurring_donations_spec.rb +++ b/spec/lib/update/update_recurring_donations_spec.rb @@ -93,8 +93,6 @@ describe UpdateRecurringDonations do orig_rd = recurring_donation.attributes.with_indifferent_access orig_donation = recurring_donation.donation.attributes.with_indifferent_access - expect_email_queued.with(JobTypes::NonprofitRecurringDonationChangeAmountJob, recurring_donation.id, orig_rd['amount']) - result = nil expect { result = UpdateRecurringDonations.update_amount(recurring_donation,