Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Exception Propagation in Integration Tests

#6418

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?

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

State: new
Milestone: none
Assigned to: nobody
Importance: none

Activity

No comments yet.