Add EventCreateJob

This commit is contained in:
Eric Schultz 2019-11-07 12:56:03 -06:00
parent 8a97e3a8af
commit e05466d0c6
4 changed files with 14 additions and 31 deletions

View file

@ -0,0 +1,7 @@
class EventCreateCreatorEmailJob < ApplicationJob
queue_as :default
def perform(event)
EventMailer.creation_followup(event).deliver_now
end
end

View file

@ -0,0 +1,7 @@
class EventCreateJob < ApplicationJob
queue_as :default
def perform(event)
EventCreateCreatorEmailJob(event)
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 EventCreationFollowupJob < EmailJob
attr_reader :event
def initialize(event)
@event = event
end
def perform
EventMailer.creation_followup(@event).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::EventCreationFollowupJob do
describe '.perform' do
it 'calls the correct active mailer' do
expect(EventMailer).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::EventCreationFollowupJob.new(1)
job.perform
end
end
end