This project is archived and is in readonly mode.

#6418 new

Exception Propagation in Integration Tests

Reported by Ed4 | February 11th, 2011 @ 10:27 PM

In Rails 2.x, you used to be able to do things like this in integration tests:

get "/customers/500"
assert_response :not_found

This kind of test allows you to verify the behavior of your rescue handlers. In my case, I'm relying on the built-in default handler to catch the ActiveRecord::RecordNotFound exception and serve up :not_found (and I'm also making assertions about how the exception gets logged and reported).

But in Rails 3.x, the RecordNotFound exception propagates out through the "get" call above, and the whole test halts without ever serving up a response, as far as I can tell.

So how are we supposed to test rescue behavior in Rails 3?

No comments found

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket