Add EventCreateJob
This commit is contained in:
parent
8a97e3a8af
commit
e05466d0c6
4 changed files with 14 additions and 31 deletions
7
app/jobs/event_create_creator_email_job.rb
Normal file
7
app/jobs/event_create_creator_email_job.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
class EventCreateCreatorEmailJob < ApplicationJob
|
||||||
|
queue_as :default
|
||||||
|
|
||||||
|
def perform(event)
|
||||||
|
EventMailer.creation_followup(event).deliver_now
|
||||||
|
end
|
||||||
|
end
|
7
app/jobs/event_create_job.rb
Normal file
7
app/jobs/event_create_job.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
class EventCreateJob < ApplicationJob
|
||||||
|
queue_as :default
|
||||||
|
|
||||||
|
def perform(event)
|
||||||
|
EventCreateCreatorEmailJob(event)
|
||||||
|
end
|
||||||
|
end
|
|
@ -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
|
|
|
@ -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
|
|
Loading…
Reference in a new issue