aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
authorArthur Neves <arthurnn@gmail.com>2014-05-13 00:03:38 -0400
committerArthur Neves <arthurnn@gmail.com>2014-05-13 00:03:38 -0400
commit7ec665303d125c945f7d59affb904f974143a087 (patch)
treef6da6ea098f525acda810c441ecc5a4e601d5200 /actionpack/lib/action_dispatch
parent84908bbde97ef70b09aca4937793052422bc06ed (diff)
downloadrails-7ec665303d125c945f7d59affb904f974143a087.tar.gz
rails-7ec665303d125c945f7d59affb904f974143a087.tar.bz2
rails-7ec665303d125c945f7d59affb904f974143a087.zip
Fix regression on `assert_redirected_to`.
`assert_redirected_to` would fail if there is no controller set on a `ActionDispatch::IntegrationTest`, as _compute_redirect_to_location would be called on the controller to build the url. This regression was introduced after 1dacfbabf3bb1e0a9057dd2a016b1804e7fa38c0. [fixes #14691]
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r--actionpack/lib/action_dispatch/testing/assertions/response.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/testing/assertions/response.rb b/actionpack/lib/action_dispatch/testing/assertions/response.rb
index 68feb26936..0adc6c84ff 100644
--- a/actionpack/lib/action_dispatch/testing/assertions/response.rb
+++ b/actionpack/lib/action_dispatch/testing/assertions/response.rb
@@ -73,7 +73,13 @@ module ActionDispatch
if Regexp === fragment
fragment
else
- @controller._compute_redirect_to_location(fragment)
+ handle = @controller || Class.new(ActionController::Metal) do
+ include ActionController::Redirecting
+ def initialize(request)
+ @_request = request
+ end
+ end.new(@request)
+ handle._compute_redirect_to_location(fragment)
end
end
end