Testing rescue_action_in_public tip

Hi All,

Here’s a trick to functional test rescue_action_in_public, I’ve been
searching in the Rails source for an hour to find it:

get(:index)
@controller.send(:erase_render_results)
@controller.send(:rescue_action_in_public,
ActionController::RoutingError.new(nil))

Calling erase_render_results after the get lets you call
rescue_action_in_public without getting DoubleRender errors. This for
example allows you to test if exception notification emails are sent
properly or if the right 404 page is rendered.

grtz

Thijs

Thanks, that worked even three years later!