Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #15084 from arthurnn/fix_assert_redirected_to

Fix regression on `assert_redirected_to`.
  • Loading branch information...
commit b95ac8a20b9764c9736046eb86e7ae1b6082d65a 2 parents fd6d6dc + 7ec6653
Andrew White pixeltrix authored
8 actionpack/lib/action_dispatch/testing/assertions/response.rb
View
@@ -73,7 +73,13 @@ def normalize_argument_to_redirection(fragment)
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
6 actionpack/test/controller/integration_test.rb
View
@@ -374,6 +374,10 @@ def test_redirect
follow_redirect!
assert_response :success
assert_equal "/get", path
+
+ get '/moved'
+ assert_response :redirect
+ assert_redirected_to '/method'
end
end
@@ -511,6 +515,8 @@ def with_test_route_set
end
set.draw do
+ get 'moved' => redirect('/method')
+
match ':action', :to => controller, :via => [:get, :post], :as => :action
get 'get/:action', :to => controller, :as => :get_action
end
Please sign in to comment.
Something went wrong with that request. Please try again.