Files
app
bin
config
db
docs
lib
log
nanobox
public
spec
controllers
fabricators
features
fixtures
helpers
javascript
lib
mailers
models
policies
presenters
requests
routing
services
support
validators
views
workers
activitypub
pubsubhubbub
scheduler
feed_cleanup_scheduler_spec.rb
media_cleanup_scheduler_spec.rb
subscriptions_scheduler_spec.rb
after_remote_follow_request_worker_spec.rb
after_remote_follow_worker_spec.rb
digest_mailer_worker_spec.rb
domain_block_worker_spec.rb
feed_insert_worker_spec.rb
regeneration_worker_spec.rb
rails_helper.rb
spec_helper.rb
streaming
vendor
.babelrc
.buildpacks
.codeclimate.yml
.dockerignore
.editorconfig
.env.nanobox
.env.production.sample
.env.test
.env.vagrant
.eslintignore
.eslintrc.yml
.foreman
.gitattributes
.gitignore
.haml-lint.yml
.nanoignore
.nvmrc
.postcssrc.yml
.profile
.rspec
.rubocop.yml
.ruby-version
.scss-lint.yml
.slugignore
.travis.yml
.yarnclean
Aptfile
CODEOWNERS
CONTRIBUTING.md
Capfile
Dockerfile
Gemfile
Gemfile.lock
ISSUE_TEMPLATE.md
LICENSE
Procfile
Procfile.dev
README.md
Rakefile
Vagrantfile
app.json
boxfile.yml
config.ru
docker-compose.yml
docker_entrypoint.sh
package.json
scalingo.json
yarn.lock
hometown/spec/workers/scheduler/feed_cleanup_scheduler_spec.rb
2017-06-28 14:50:23 +02:00

23 lines
658 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
Redis.current.zadd(feed_key_for(inactive_user), 1, 1)
Redis.current.zadd(feed_key_for(active_user), 1, 1)
subject.perform
expect(Redis.current.zcard(feed_key_for(inactive_user))).to eq 0
expect(Redis.current.zcard(feed_key_for(active_user))).to eq 1
end
def feed_key_for(user)
FeedManager.instance.key(:home, user.account_id)
end
end