0
0
Fork 0

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
This commit is contained in:
Matt Jankowski 2017-05-22 13:36:21 -04:00 committed by Eugen Rochko
parent 4a4733b397
commit ec34ec63b1
6 changed files with 39 additions and 2 deletions

View file

@ -0,0 +1,15 @@
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