Create AdminFailedGiftJob
This commit is contained in:
parent
7b4b4573b0
commit
99373d5792
3 changed files with 7 additions and 32 deletions
7
app/jobs/admin_failed_gift_job.rb
Normal file
7
app/jobs/admin_failed_gift_job.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
class AdminFailedGiftJob < ApplicationJob
|
||||||
|
queue_as :default
|
||||||
|
|
||||||
|
def perform(donation, campaign_gift_option)
|
||||||
|
AdminMailer.notify_failed_gift(donation, campaign_gift_option)
|
||||||
|
end
|
||||||
|
end
|
|
@ -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 AdminFailedGiftJob < EmailJob
|
|
||||||
attr_reader :donation, :campaign_gift_option
|
|
||||||
|
|
||||||
def initialize(donation, campaign_gift_option)
|
|
||||||
@donation = donation
|
|
||||||
@campaign_gift_option = campaign_gift_option
|
|
||||||
end
|
|
||||||
|
|
||||||
def perform
|
|
||||||
AdminMailer.notify_failed_gift(@donation, @campaign_gift_option).deliver
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -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::AdminFailedGiftJob do
|
|
||||||
describe '.perform' do
|
|
||||||
it 'calls the correct active mailer' do
|
|
||||||
expect(AdminMailer).to receive(:notify_failed_gift).with(1, 2).and_wrap_original { |_m, *_args| mailer = double('object'); expect(mailer).to receive(:deliver).and_return(nil); mailer }
|
|
||||||
|
|
||||||
job = JobTypes::AdminFailedGiftJob.new(1, 2)
|
|
||||||
job.perform
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Add table
Reference in a new issue