提交 14508aec 编写于 作者: G Guo Xiang Tan

Remove ActionController::RaiseActionExceptions.

The latest modification to the code was done in https://github.com/rails/rails/commit/5e3517ea. In Rails 3.2,
`ActionController#rescue_action` was deprecated and `rescue_action_without_handler` is no longer being used.
上级 e6e81f85
......@@ -456,7 +456,6 @@ def tests(controller_class)
end
def controller_class=(new_class)
prepare_controller_class(new_class) if new_class
self._controller_class = new_class
end
......@@ -473,11 +472,6 @@ def determine_default_controller_class(name)
Class === constant && constant < ActionController::Metal
end
end
def prepare_controller_class(new_class)
new_class.send :include, ActionController::TestCase::RaiseActionExceptions
end
end
# Simulate a GET request with the given parameters.
......@@ -713,34 +707,6 @@ def html_format?(parameters)
end
end
# 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.
module RaiseActionExceptions
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
protected
def rescue_action_without_handler(e)
self.exception = e
if request.remote_addr == "0.0.0.0"
raise(e)
else
super(e)
end
end
end
include Behavior
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册