pustserg
pustserg

Reputation: 141

How to simulate Request Timeout in rspec with faraday

I use Faraday gem in app, and I want to test how my app works when Faraday connection fails by timeout. How can I stub request for this case?

Upvotes: 2

Views: 4122

Answers (1)

pustserg
pustserg

Reputation: 141

I found a working method. May be it is not beautiful, but is works.

faraday_adapter.post('fail') do
  raise Faraday::TimeoutError
end

Upvotes: 2

Related Questions