Permalink
Browse files

Deprecation: verification with :redirect_to => :named_route shouldn't…

… be deprecated. Closes #7525.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6422 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 14cc8d2 commit 1f022710488aba694177bb4c33ad99f073eeabb2 @jeremy jeremy committed Mar 14, 2007
View
@@ -1,5 +1,7 @@
*SVN*
+* Deprecation: verification with :redirect_to => :named_route shouldn't be deprecated. #7525 [Justin French]
+
* Cookie session store: raise ArgumentError when :session_key is blank. [Jeremy Kemper]
* Deprecation: remove deprecated request, redirect, and dependency methods. Remove deprecated instance variables. Remove deprecated url_for(:symbol, *args) and redirect_to(:symbol, *args) in favor of named routes. Remove uses_component_template_root for toplevel components directory. Privatize deprecated render_partial and render_partial_collection view methods. Remove deprecated link_to_image, link_image_to, update_element_function, start_form_tag, and end_form_tag helper methods. Remove deprecated human_size helper alias. [Jeremy Kemper]
@@ -95,6 +95,7 @@ def verify_action(options) #:nodoc:
response.headers.update(options[:add_headers]) if options[:add_headers]
unless performed?
render(options[:render]) if options[:render]
+ options[:redirect_to] = self.send(options[:redirect_to]) if options[:redirect_to].is_a? Symbol
redirect_to(options[:redirect_to]) if options[:redirect_to]
end
return false
@@ -34,9 +34,16 @@ class TestController < ActionController::Base
verify :only => :must_be_post, :method => :post, :render => { :status => 405, :text => "Must be post" }, :add_headers => { "Allow" => "POST" }
+ verify :only => :guarded_one_for_named_route_test, :params => "one",
+ :redirect_to => :foo_url
+
def guarded_one
render :text => "#{params[:one]}"
end
+
+ def guarded_one_for_named_route_test
+ render :text => "#{params[:one]}"
+ end
def guarded_with_flash
render :text => "#{params[:one]}"
@@ -94,6 +101,14 @@ def setup
@controller = TestController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
+ ActionController::Routing::Routes.add_named_route :foo, '/foo', :controller => 'test', :action => 'foo'
+ end
+
+ def test_no_deprecation_warning_for_named_route
+ assert_not_deprecated do
+ get :guarded_one_for_named_route_test, :two => "not one"
+ assert_redirected_to '/foo'
+ end
end
def test_guarded_one_with_prereqs

0 comments on commit 1f02271

Please sign in to comment.