diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-04-28 20:19:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-28 20:19:10 +0200 |
commit | 84d991988eb076a7d83c771b3266f66f1c8a9754 (patch) | |
tree | 59642ee49c4f413b390dcb976a1d3de7216b981a /spec | |
parent | 8284110c55679b7ce7b3922cb0559620b03ca88c (diff) |
Fix temporary network/remote server error prevent from interactions with remote accounts (#18161)
* Fix temporary network/remote server error prevent from interactions with remote accounts * Fix and add tests
Diffstat (limited to 'spec')
-rw-r--r-- | spec/services/resolve_url_service_spec.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/spec/services/resolve_url_service_spec.rb b/spec/services/resolve_url_service_spec.rb index a38b23590..1b639dea9 100644 --- a/spec/services/resolve_url_service_spec.rb +++ b/spec/services/resolve_url_service_spec.rb @@ -7,15 +7,29 @@ describe ResolveURLService, type: :service do describe '#call' do it 'returns nil when there is no resource url' do - url = 'http://example.com/missing-resource' + url = 'http://example.com/missing-resource' + known_account = Fabricate(:account, uri: url) service = double allow(FetchResourceService).to receive(:new).and_return service + allow(service).to receive(:response_code).and_return(404) allow(service).to receive(:call).with(url).and_return(nil) expect(subject.call(url)).to be_nil end + it 'returns known account on temporary error' do + url = 'http://example.com/missing-resource' + known_account = Fabricate(:account, uri: url) + service = double + + allow(FetchResourceService).to receive(:new).and_return service + allow(service).to receive(:response_code).and_return(500) + allow(service).to receive(:call).with(url).and_return(nil) + + expect(subject.call(url)).to eq known_account + end + context 'searching for a remote private status' do let(:account) { Fabricate(:account) } let(:poster) { Fabricate(:account, domain: 'example.com') } |