1
0
mirror of https://github.com/mastodon/mastodon synced 2024-11-25 15:46:24 +09:00
mastodon/spec/workers/scheduler/media_cleanup_scheduler_spec.rb
Matt Jankowski ec34ec63b1 Specs for cleanup workers (#3235)
* Add spec files for feed and media cleanup workers

* Add coverage for feed and media cleanup schedulers

* Clean up feed and media cleanup workers
2017-05-22 19:36:21 +02:00

16 lines
481 B
Ruby

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