闭社主体 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.

19 lines
579 B

  1. require 'rails_helper'
  2. describe Scheduler::FeedCleanupScheduler do
  3. subject { described_class.new }
  4. let!(:active_user) { Fabricate(:user, current_sign_in_at: 2.days.ago) }
  5. let!(:inactive_user) { Fabricate(:user, current_sign_in_at: 22.days.ago) }
  6. it 'clears feeds of inactives' do
  7. expect_any_instance_of(Redis).to receive(:del).with(feed_key_for(inactive_user))
  8. expect_any_instance_of(Redis).not_to receive(:del).with(feed_key_for(active_user))
  9. subject.perform
  10. end
  11. def feed_key_for(user)
  12. FeedManager.instance.key(:home, user.account_id)
  13. end
  14. end