Skip to content

Commit

Permalink
Fixed call_with_exception for Routing Errors [#1684 state:resolved]
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Peek <josh@joshpeek.com>
  • Loading branch information
lackac authored and josh committed Jan 2, 2009
1 parent f90160c commit 606176a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions actionpack/lib/action_controller/rescue.rb
Expand Up @@ -60,8 +60,8 @@ def self.included(base) #:nodoc:

module ClassMethods
def call_with_exception(env, exception) #:nodoc:
request = env["actioncontroller.rescue.request"]
response = env["actioncontroller.rescue.response"]
request = env["actioncontroller.rescue.request"] ||= Request.new(env)
response = env["actioncontroller.rescue.response"] ||= Response.new
new.process(request, response, :rescue_action, exception)
end
end
Expand Down
7 changes: 7 additions & 0 deletions actionpack/test/controller/rescue_test.rb
Expand Up @@ -390,6 +390,13 @@ def test_rescue_dispatcher_exceptions
assert_equal "no way", @response.body
end

def test_rescue_dispatcher_exceptions_without_request_set
@request.env['REQUEST_URI'] = '/no_way'
response = RescueController.call_with_exception(@request.env, ActionController::RoutingError.new("Route not found"))
assert_kind_of ActionController::Response, response
assert_equal "no way", response.body
end

protected
def with_all_requests_local(local = true)
old_local, ActionController::Base.consider_all_requests_local =
Expand Down

0 comments on commit 606176a

Please sign in to comment.