remove AdminNoticeJob

This commit is contained in:
Eric Schultz 2019-11-07 14:51:34 -06:00
parent 4b8bb49d76
commit a4b32cf949
4 changed files with 3 additions and 34 deletions

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 AdminNoticeJob < EmailJob
attr_reader :options
def initialize(options)
@options = options
end
def perform
GenericMailer.admin_notice(@options).deliver
end
end
end

View file

@ -8,5 +8,5 @@ task send_health_report: :environment do
GenericMailer.admin_notice(
body: HealthReport.format_data(HealthReport.query_data),
subject: "CommitChange activity report #{Format::Date.to_readable(Time.now)}"
).deliver
).deliver_later
end

View file

@ -18,8 +18,8 @@ task :heroku_scheduled_job, [:name] => :environment do |_t, args|
rescue Exception => e
results += "Failure: #{e}\n"
end
GenericMailer.delay.admin_notice(
GenericMailer.admin_notice(
subject: "Scheduled job results on CommitChange for '#{job_name}'",
body: results.empty? ? 'No jobs to run today.' : results
)
).deliver_later
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::AdminNoticeJob do
describe '.perform' do
it 'calls the correct active mailer' do
expect(GenericMailer).to receive(:admin_notice).with(1).and_wrap_original { |_m, *_args| mailer = double('object'); expect(mailer).to receive(:deliver).and_return(nil); mailer }
job = JobTypes::AdminNoticeJob.new(1)
job.perform
end
end
end