This repository has been archived on 2019-05-14. You can view files and clone it, but cannot push or open issues or pull requests.
mastodon/spec/workers/scheduler/feed_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

20 lines
579 B
Ruby

require 'rails_helper'
describe Scheduler::FeedCleanupScheduler do
subject { described_class.new }
let!(:active_user) { Fabricate(:user, current_sign_in_at: 2.days.ago) }
let!(:inactive_user) { Fabricate(:user, current_sign_in_at: 22.days.ago) }
it 'clears feeds of inactives' do
expect_any_instance_of(Redis).to receive(:del).with(feed_key_for(inactive_user))
expect_any_instance_of(Redis).not_to receive(:del).with(feed_key_for(active_user))
subject.perform
end
def feed_key_for(user)
FeedManager.instance.key(:home, user.account_id)
end
end