From a5fe13e871506e242071a6b0d0d96d1d9a78469a Mon Sep 17 00:00:00 2001 From: Nicholas Seckar Date: Sat, 12 May 2007 04:18:46 +0000 Subject: Add ActionController::Routing::Helpers, a module to contain common URL helpers such as polymorphic_url. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6722 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/controller/action_pack_assertions_test.rb | 2 +- actionpack/test/controller/routing_test.rb | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'actionpack/test') diff --git a/actionpack/test/controller/action_pack_assertions_test.rb b/actionpack/test/controller/action_pack_assertions_test.rb index e4624484ec..1aefbfd677 100644 --- a/actionpack/test/controller/action_pack_assertions_test.rb +++ b/actionpack/test/controller/action_pack_assertions_test.rb @@ -209,7 +209,7 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase map.route_one 'route_one', :controller => 'action_pack_assertions', :action => 'nothing' map.connect ':controller/:action/:id' end - set.named_routes.install + set.install_helpers process :redirect_to_named_route assert_redirected_to 'http://test.host/route_one' diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index 986737c4dc..658059cefe 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -207,7 +207,7 @@ class LegacyRouteSetTests < Test::Unit::TestCase def setup_for_named_route x = Class.new x.send(:define_method, :url_for) {|x| x} - rs.named_routes.install(x) + rs.install_helpers(x) x end @@ -1417,7 +1417,7 @@ class RouteSetTest < Test::Unit::TestCase end klass = Class.new(MockController) - set.named_routes.install(klass) + set.install_helpers(klass) klass.new(set) end @@ -1885,4 +1885,14 @@ class RoutingTest < Test::Unit::TestCase assert_equal %w(vendor\\rails\\railties\\builtin\\rails_info vendor\\rails\\actionpack\\lib app\\controllers app\\helpers app\\models lib .), paths end + def test_routing_helper_module + assert_kind_of Module, ActionController::Routing::Helpers + + h = ActionController::Routing::Helpers + c = Class.new + assert ! c.ancestors.include?(h) + ActionController::Routing::Routes.install_helpers c + assert c.ancestors.include?(h) + end + end -- cgit v1.2.3