aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/url_helper_test.rb
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2010-06-27 08:03:39 +0100
committerJosé Valim <jose.valim@gmail.com>2010-06-27 09:23:36 +0200
commit91b52c795f62aa15505f2f098bc86d6f6db75105 (patch)
treec3feb1da8784bc8da5a99f30788d0f58dbef1867 /actionpack/test/template/url_helper_test.rb
parentabd568bf1c48e9082c0be7407eca1155c5fe0599 (diff)
downloadrails-91b52c795f62aa15505f2f098bc86d6f6db75105.tar.gz
rails-91b52c795f62aa15505f2f098bc86d6f6db75105.tar.bz2
rails-91b52c795f62aa15505f2f098bc86d6f6db75105.zip
Normalize recall params when the route is not a standard route otherwise :controller and :action may appear in the generated url [#4326 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/test/template/url_helper_test.rb')
-rw-r--r--actionpack/test/template/url_helper_test.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb
index 299d6dd5bd..72d4897630 100644
--- a/actionpack/test/template/url_helper_test.rb
+++ b/actionpack/test/template/url_helper_test.rb
@@ -429,6 +429,10 @@ class UrlHelperControllerTest < ActionController::TestCase
map.connect ":controller/:action/:id"
# match "/:controller(/:action(/:id))"
+
+ match 'url_helper_controller_test/url_helper/normalize_recall_params',
+ :to => UrlHelperController.action(:normalize_recall),
+ :as => :normalize_recall_params
end
def show_url_for
@@ -447,6 +451,14 @@ class UrlHelperControllerTest < ActionController::TestCase
render :inline => '<%= url_for(nil) %>'
end
+ def normalize_recall_params
+ render :inline => '<%= normalize_recall_params_path %>'
+ end
+
+ def recall_params_not_changed
+ render :inline => '<%= url_for(:action => :show_url_for) %>'
+ end
+
def rescue_action(e) raise e end
end
@@ -488,6 +500,16 @@ class UrlHelperControllerTest < ActionController::TestCase
get :show_named_route, :kind => 'url'
assert_equal 'http://testtwo.host/url_helper_controller_test/url_helper/show_named_route', @response.body
end
+
+ def test_recall_params_should_be_normalized_when_using_block_route
+ get :normalize_recall_params
+ assert_equal '/url_helper_controller_test/url_helper/normalize_recall_params', @response.body
+ end
+
+ def test_recall_params_should_not_be_changed_when_using_normal_route
+ get :recall_params_not_changed
+ assert_equal '/url_helper_controller_test/url_helper/show_url_for', @response.body
+ end
end
class TasksController < ActionController::Base