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
876 B

  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