imap_authentication_migration_cleanup_job_spec.rb 707 B

123456789101112131415161718192021222324252627282930
  1. require 'rails_helper'
  2. RSpec.describe ImapAuthenticationMigrationCleanupJob, type: :job do
  3. let(:migrated_at) { 8.days.ago }
  4. let(:channel) do
  5. channel = build(:channel, area: 'Google::Account')
  6. channel.options[:backup_imap_classic] = {
  7. backuphere: 1,
  8. migrated_at: migrated_at
  9. }
  10. channel.save!
  11. channel
  12. end
  13. it 'deletes obsolete classic IMAP backup' do
  14. expect { described_class.perform_now }.to change { channel.reload.options }
  15. end
  16. context 'recently migrated' do
  17. let(:migrated_at) { Time.zone.now }
  18. it 'keeps classic IMAP backup untouched' do
  19. expect { described_class.perform_now }.not_to change { channel.reload.options }
  20. end
  21. end
  22. end