From 7b4b4573b045b2f198a749b25eb3d051e8e6d01b Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Wed, 6 Nov 2019 16:44:21 -0600 Subject: [PATCH] Add CampaignCreationEmailFollowupJob --- app/jobs/campaign_creation_email_followup_job.rb | 7 +++++++ lib/job_types/campaign_creation_followup_job.rb | 16 ---------------- .../campaign_creation_followup_job_spec.rb | 15 --------------- 3 files changed, 7 insertions(+), 31 deletions(-) create mode 100644 app/jobs/campaign_creation_email_followup_job.rb delete mode 100644 lib/job_types/campaign_creation_followup_job.rb delete mode 100644 spec/lib/job_types/campaign_creation_followup_job_spec.rb diff --git a/app/jobs/campaign_creation_email_followup_job.rb b/app/jobs/campaign_creation_email_followup_job.rb new file mode 100644 index 00000000..b87bdc2b --- /dev/null +++ b/app/jobs/campaign_creation_email_followup_job.rb @@ -0,0 +1,7 @@ +class CampaignCreationEmailFollowupJob < ApplicationJob + queue_as :default + + def perform(campaign) + CampaignMailer.creation_followup(campaign).deliver_now + end +end diff --git a/lib/job_types/campaign_creation_followup_job.rb b/lib/job_types/campaign_creation_followup_job.rb deleted file mode 100644 index 6c92b870..00000000 --- a/lib/job_types/campaign_creation_followup_job.rb +++ /dev/null @@ -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 diff --git a/spec/lib/job_types/campaign_creation_followup_job_spec.rb b/spec/lib/job_types/campaign_creation_followup_job_spec.rb deleted file mode 100644 index 3135defd..00000000 --- a/spec/lib/job_types/campaign_creation_followup_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::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