after_unallow_domain_service_spec.rb 841 B

123456789101112131415161718192021222324
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe AfterUnallowDomainService do
  4. describe '#call' do
  5. context 'with accounts for a domain' do
  6. let!(:account) { Fabricate(:account, domain: 'host.example') }
  7. let!(:test_account) { Fabricate(:account, domain: 'test.example') }
  8. let(:service_double) { instance_double(DeleteAccountService, call: true) }
  9. before { allow(DeleteAccountService).to receive(:new).and_return(service_double) }
  10. it 'calls the delete service for accounts from the relevant domain' do
  11. subject.call 'test.example'
  12. expect(service_double)
  13. .to_not have_received(:call).with(account, reserve_username: false)
  14. expect(service_double)
  15. .to have_received(:call).with(test_account, reserve_username: false)
  16. end
  17. end
  18. end
  19. end