active_job_lock_cleanup_job_scheduler_spec.rb 618 B

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