Add CampaignCreationEmailFollowupJob

This commit is contained in:
Eric Schultz 2019-11-06 16:44:21 -06:00
parent 211317f05f
commit 7b4b4573b0
3 changed files with 7 additions and 31 deletions

View file

@ -0,0 +1,7 @@
class CampaignCreationEmailFollowupJob < ApplicationJob
queue_as :default
def perform(campaign)
CampaignMailer.creation_followup(campaign).deliver_now
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 CampaignCreationFollowupJob < EmailJob
attr_reader :campaign
def initialize(campaign)
@campaign = campaign
end
def perform
CampaignMailer.creation_followup(@campaign).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::CampaignCreationFollowupJob do
describe '.perform' do
it 'calls the correct active mailer' do
expect(CampaignMailer).to receive(:creation_followup).with(1).and_wrap_original { |_m, *_args| mailer = double('object'); expect(mailer).to receive(:deliver).and_return(nil); mailer }
job = JobTypes::CampaignCreationFollowupJob.new(1)
job.perform
end
end
end