# Testing rescue\_action\_in\_public tip

**URL:** <https://www.ruby-forum.com/t/testing-rescue-action-in-public-tip/87734>\
**Category:** Rails\
**Created:** [March 5, 2007, 5:25pm UTC](https://www.ruby-forum.com/t/testing-rescue-action-in-public-tip/87734 "2007-03-05T17:25:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![thijs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a4c791/32.png) [@thijs](https://www.ruby-forum.com/u/thijs)\
**Post date:** [March 5, 2007, 5:25pm UTC](https://www.ruby-forum.com/t/testing-rescue-action-in-public-tip/87734/1 "2007-03-05T17:25:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![thijs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a4c791/32.png) [@thijs](https://www.ruby-forum.com/u/thijs)\
**Post date:** [July 23, 2010, 7:22pm UTC](https://www.ruby-forum.com/t/testing-rescue-action-in-public-tip/87734/2 "2010-07-23T19:22:21Z")

</div>

Thanks, that worked even three years later!
