闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
481 B

  1. require 'rails_helper'
  2. describe Scheduler::MediaCleanupScheduler do
  3. subject { described_class.new }
  4. let!(:old_media) { Fabricate(:media_attachment, account_id: nil, created_at: 10.days.ago) }
  5. let!(:new_media) { Fabricate(:media_attachment, account_id: nil, created_at: 1.hour.ago) }
  6. it 'removes old media records' do
  7. subject.perform
  8. expect { old_media.reload }.to raise_error(ActiveRecord::RecordNotFound)
  9. expect(new_media.reload).to be_persisted
  10. end
  11. end