about summary refs log tree commit diff
path: root/spec/controllers
diff options
context:
space:
mode:
authorabcang <abcang1015@gmail.com>2017-08-29 02:12:09 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-08-28 19:12:09 +0200
commitce9a5f358ed1ea5039c1de0bc896dc60622852f7 (patch)
treeaaa1be760ae3ddf6aa52cdd5464a537244ed55f0 /spec/controllers
parent8f527bd5884ccb8bfc7f1ff583fa35ae4fa6618c (diff)
rescue HTTP::ConnectionError in RemoteFollowController#create (#4726)
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/remote_follow_controller_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/controllers/remote_follow_controller_spec.rb b/spec/controllers/remote_follow_controller_spec.rb
index 915c86f8e..86b1eb8d0 100644
--- a/spec/controllers/remote_follow_controller_spec.rb
+++ b/spec/controllers/remote_follow_controller_spec.rb
@@ -87,6 +87,14 @@ describe RemoteFollowController do
         expect(response).to render_template(:new)
         expect(response.body).to include(I18n.t('remote_follow.missing_resource'))
       end
+
+      it 'renders new when occur HTTP::ConnectionError' do
+        allow(Goldfinger).to receive(:finger).with('acct:user@unknown').and_raise(HTTP::ConnectionError)
+        post :create, params: { account_username: @account.to_param, remote_follow: { acct: 'user@unknown' } }
+
+        expect(response).to render_template(:new)
+        expect(response.body).to include(I18n.t('remote_follow.missing_resource'))
+      end
     end
   end