Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在应用程序中使用 Faraday gem,我想测试当 Faraday 连接因超时而失败时我的应用程序如何工作。对于这种情况,我如何存根请求?
我找到了一种工作方法。也许它并不美丽,但它是作品。
faraday_adapter.post('fail') do raise Faraday::TimeoutError end