Rails - How to stub a certain response time for a stubbed / fake http or ajax response
问题 I want to test a feature that in my app sends the usera custom message when a Rails UJS/ajax times-out. The code to timeout the Rails UJS request is itself on the app: $.rails.ajax = function(options) { if (!options.timeout) { options.timeout = 10000; } return $.ajax(options); }; When observing on chrome dev tools what happened when it timed out on my local dev mode, I notice the code status is strangely 200 but as it "times out", my message is indeed displayed to the user. on('ajax:error'