Module: ActionController::TestCase::RaiseActionExceptions

Defined in:
lib/action_controller/test_case.rb

Overview

When the request.remote_addr remains the default for testing, which is 0.0.0.0, the exception is simply raised inline (skipping 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 0.0.0.0.

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

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

:nodoc:



675
676
677
678
679
680
681
682
# File 'lib/action_controller/test_case.rb', line 675

def self.included(base) #:nodoc:
  unless base.method_defined?(:exception) && base.method_defined?(:exception=)
    base.class_eval do
      attr_accessor :exception
      protected :exception, :exception=
    end
  end
end