aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/test_process.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb
index b35439249d..c13fe82328 100644
--- a/actionpack/lib/action_controller/test_process.rb
+++ b/actionpack/lib/action_controller/test_process.rb
@@ -374,8 +374,9 @@ module ActionController #:nodoc:
alias xhr :xml_http_request
def follow_redirect
- if @response.redirected_to[:controller]
- raise "Can't follow redirects outside of current controller (#{@response.redirected_to[:controller]})"
+ redirected_controller = @response.redirected_to[:controller]
+ if redirected_controller && redirected_controller != @controller.controller_name
+ raise "Can't follow redirects outside of current controller (from #{@controller.controller_name} to #{redirected_controller})"
end
get(@response.redirected_to.delete(:action), @response.redirected_to.stringify_keys)