Browse Source

Refactoring: Prefer ActiveJob helpers instead of quering job processing backend (Delayed::Job) directly.

Thorsten Eckel 5 years ago
parent
commit
e2af543016
1 changed files with 3 additions and 2 deletions
  1. 3 2
      spec/models/calendar_spec.rb

+ 3 - 2
spec/models/calendar_spec.rb

@@ -129,9 +129,10 @@ RSpec.describe Calendar, type: :model do
         end
       end
 
-      context 'and current date has changed (past cache expiry)' do
+      context 'and current date has changed (past cache expiry)', performs_jobs: true do
         before do
           calendar  # create and sync
+          clear_jobs # clear (speak: process) created jobs
           travel 1.year
         end
 
@@ -146,7 +147,7 @@ RSpec.describe Calendar, type: :model do
         end
 
         it 'does create a background job for escalation rebuild' do
-          expect { calendar.sync }.to change { Delayed::Job.count }.by(1)
+          expect { calendar.sync }.to have_enqueued_job(SlaTicketRebuildEscalationJob)
         end
       end