logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

subscriptions_scheduler_spec.rb (876B)


  1. require 'rails_helper'
  2. describe Scheduler::SubscriptionsScheduler do
  3. subject { Scheduler::SubscriptionsScheduler.new }
  4. let!(:expiring_account1) { Fabricate(:account, subscription_expires_at: 20.minutes.from_now, domain: 'example.com', followers_count: 1, hub_url: 'http://hub.example.com') }
  5. let!(:expiring_account2) { Fabricate(:account, subscription_expires_at: 4.hours.from_now, domain: 'example.org', followers_count: 1, hub_url: 'http://hub.example.org') }
  6. before do
  7. stub_request(:post, 'http://hub.example.com/').to_return(status: 202)
  8. stub_request(:post, 'http://hub.example.org/').to_return(status: 202)
  9. end
  10. it 're-subscribes for all expiring accounts' do
  11. subject.perform
  12. expect(a_request(:post, 'http://hub.example.com/')).to have_been_made.once
  13. expect(a_request(:post, 'http://hub.example.org/')).to have_been_made.once
  14. end
  15. end