resolve_account_worker_spec.rb 803 B

12345678910111213141516171819202122232425262728293031323334353637
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe ResolveAccountWorker do
  4. let(:worker) { described_class.new }
  5. let(:service) { instance_double(ResolveAccountService, call: true) }
  6. describe 'perform' do
  7. context 'with missing values' do
  8. it 'runs without error' do
  9. expect { worker.perform(nil) }
  10. .to_not raise_error
  11. end
  12. end
  13. context 'with a URI' do
  14. before { stub_service }
  15. let(:uri) { 'https://host/path/value' }
  16. it 'initiates account resolution' do
  17. worker.perform(uri)
  18. expect(service)
  19. .to have_received(:call)
  20. .with(uri)
  21. end
  22. def stub_service
  23. allow(ResolveAccountService)
  24. .to receive(:new)
  25. .and_return(service)
  26. end
  27. end
  28. end
  29. end