How to add a delay to Rails controller for testing?

Controller like so:

def catalog
  #Makes the request pause 1.5 seconds
  sleep 1.5

  ...
end

Even better: only add the sleep for the dev environment.

Leave a Comment