active_job_lock_cleanup_job_scheduler_spec.rb 695 B

12345678910111213141516171819202122232425
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe ActiveJobLockCleanupJobScheduler, type: :db_migration do
  4. let(:scheduler_method) { 'ActiveJobLockCleanupJob.perform_now' }
  5. context 'New system', system_init_done: false do
  6. it 'has no work to do' do
  7. expect { migrate }.not_to change { Scheduler.exists?(method: scheduler_method) }.from(true)
  8. end
  9. end
  10. context 'System that is already set up' do
  11. before do
  12. Scheduler.find_by(method: scheduler_method).destroy!
  13. end
  14. it 'creates Scheduler' do
  15. expect { migrate }.to change { Scheduler.exists?(method: scheduler_method) }
  16. end
  17. end
  18. end