When the request.remote_addr remains the default for testing, which is, the exception is simply raised inline (bystepping the regular exception handling from rescue_action). If the request.remote_addr is anything else, the regular rescue_action process takes place. This means you can test your rescue_action code by setting remote_addr to something else than

The exception is stored in the exception accessor for further inspection.

Public Class methods
     # File actionpack/lib/action_controller/test_case.rb, line 135
135:       def self.included(base)
136:         base.class_eval do
137:           attr_accessor :exception
138:           protected :exception, :exception=
139:         end
140:       end
Protected Instance methods
     # File actionpack/lib/action_controller/test_case.rb, line 143
143:         def rescue_action_without_handler(e)
144:           self.exception = e
146:           if request.remote_addr == ""
147:             raise(e)
148:           else
149:             super(e)
150:           end
151:         end