raise ActiveRecord::RecordNotFound if follow_params[:uri].blank?
@account = FollowService.new.call(current_user.account, target_uri).try(:target_account)
+
+ if @account.nil?
+ username, domain = target_uri.split('@')
+ @account = Account.find_remote!(username, domain)
+ end
+
render json: @account, serializer: REST::AccountSerializer
end
it 'subscribes to remote hub' do
expect(a_request(:post, "https://quitter.no/main/push/hub")).to have_been_made
end
+
+ it 'returns http success if already following, too' do
+ post :create, params: { uri: 'gargron@quitter.no' }
+ expect(response).to have_http_status(:success)
+ end
end
end