Permalink
Browse files

Refactoring: Migrated Observer::Sla::TicketRebuildEscalation::Backgro…

…undJob from Delayed::Job to Active Job.
  • Loading branch information...
rolfschmidt authored and thorsteneckel committed Jan 24, 2019
1 parent b3cb678 commit b370975a014a2a72240cd243dc5f429dc1550839
@@ -0,0 +1,6 @@
class SlaTicketRebuildEscalationJob < ApplicationJob
def perform(_sla_id)
Cache.delete('SLA::List::Active')
Ticket::Escalation.rebuild_all
end
end
@@ -13,7 +13,7 @@ def _rebuild(record)
Cache.delete('SLA::List::Active')

# send background job
Delayed::Job.enqueue( Observer::Sla::TicketRebuildEscalation::BackgroundJob.new(record.id) )
SlaTicketRebuildEscalationJob.perform_later(record.id)
end

def _check(record)

This file was deleted.

Oops, something went wrong.
@@ -0,0 +1,12 @@
require 'rails_helper'

RSpec.describe SlaTicketRebuildEscalationJob, type: :job do

it 'executes the job' do
sla = create(:sla)

expect(Cache).to receive(:delete).with('SLA::List::Active')
expect(Ticket::Escalation).to receive(:rebuild_all)
described_class.perform_now(sla.id)
end
end

0 comments on commit b370975

Please sign in to comment.