Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save calebphillips/3100295 to your computer and use it in GitHub Desktop.
Save calebphillips/3100295 to your computer and use it in GitHub Desktop.
require 'benchmark'
class ActionController::TestCase
alias __old_process__ process
def process(*args)
max_time = 0.2
time = Benchmark.realtime { __old_process__(*args) }
assert time < max_time, exceeded_run_time(time, max_time)
end
private
def exceeded_run_time(time, max_time)
"Request time of #{time} seconds is greater than the max allowed time of #{max_time}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment