feed_cleanup_scheduler_spec.rb 579 B

12345678910111213141516171819
  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