Remove WelcomeEnterpriseJob

This commit is contained in:
Matt-Yorkley
2021-01-09 11:33:10 +00:00
parent 3877721209
commit 6a7f795f64
4 changed files with 4 additions and 25 deletions

View File

@@ -1,8 +0,0 @@
# frozen_string_literal: true
class WelcomeEnterpriseJob < ActiveJob::Base
def perform(enterprise_id)
enterprise = Enterprise.find enterprise_id
EnterpriseMailer.welcome(enterprise).deliver_now
end
end

View File

@@ -400,7 +400,7 @@ class Enterprise < ActiveRecord::Base
end
def send_welcome_email
WelcomeEnterpriseJob.perform_later(id)
EnterpriseMailer.welcome(self).deliver_later
end
def strip_url(url)

View File

@@ -1,15 +0,0 @@
# frozen_string_literal: true
require 'spec_helper'
describe WelcomeEnterpriseJob do
let(:enterprise) { create(:enterprise) }
it "sends a welcome email to the enterprise" do
mail = double(:mail)
expect(EnterpriseMailer).to receive(:welcome).with(enterprise).and_return(mail)
expect(mail).to receive(:deliver_now)
WelcomeEnterpriseJob.perform_now(enterprise.id)
end
end

View File

@@ -11,7 +11,9 @@ describe Enterprise do
it "sends a welcome email" do
expect do
create(:enterprise, owner: user)
end.to enqueue_job WelcomeEnterpriseJob
end.to enqueue_job ActionMailer::DeliveryJob
expect(enqueued_jobs.last.to_s).to match "welcome"
end
end
end