rails/rails — pull request #11289 by senny (2013-07-04 10:37:29+00:00)
Title: activate error handling in integration tests `with_rails_error_handling`

I recently faced a situation where I was integration testing an API and wanted to let Rails handle the raised errors. Sadly passing `"action_dispatch.show_exceptions" => true` to the request won't work as it get's overwritten (https://github.com/rails/rails/blob/master/railties/lib/rails/engine.rb#L507).

Changing `Rails.application.env_config` in a single test-case has side effects and it's important to restore the original value. That's why I created this simple helper method for `ActionDispacth::IntegrationTest`:

```ruby
test "som example API call" do
with_rais_error_handling do
get "/active_record/not_found"
end

assert_equal 404, status
end
```