about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/services/resolve_url_service_spec.rb16
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') }