aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/routing_test.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-06-27 08:38:55 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-06-27 08:38:55 +0000
commit557e19346ad144deecd7d76a8a4e4cec22a6597e (patch)
tree7fd3817020f4ba93d406c824ad595f646fd6b88a /actionpack/test/controller/routing_test.rb
parentb5b16a80a9e0386781b370cf110fdc26e13dbc61 (diff)
downloadrails-557e19346ad144deecd7d76a8a4e4cec22a6597e.tar.gz
rails-557e19346ad144deecd7d76a8a4e4cec22a6597e.tar.bz2
rails-557e19346ad144deecd7d76a8a4e4cec22a6597e.zip
Prefix nested resource named routes with their action name, e.g. new_group_user_path(@group) instead of group_new_user_path(@group). The old nested action named route is deprecated in Rails 1.2.4. Closes #8558.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7138 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller/routing_test.rb')
-rw-r--r--actionpack/test/controller/routing_test.rb38
1 files changed, 37 insertions, 1 deletions
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index 9e5e9e1617..758d37396a 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -1024,6 +1024,42 @@ class RouteTest < Test::Unit::TestCase
end
end
+class MapperDeprecatedRouteTest < Test::Unit::TestCase
+ def setup
+ @set = mock("set")
+ @mapper = ActionController::Routing::RouteSet::Mapper.new(@set)
+ end
+
+ def test_should_add_new_and_deprecated_named_routes
+ @set.expects(:add_named_route).with("new", "path", {:a => "b"})
+ @set.expects(:add_deprecated_named_route).with("new", "old", "path", {:a => "b"})
+ @mapper.deprecated_named_route("new", "old", "path", {:a => "b"})
+ end
+
+ def test_should_not_add_deprecated_named_route_if_both_are_the_same
+ @set.expects(:add_named_route).with("new", "path", {:a => "b"})
+ @set.expects(:add_deprecated_named_route).with("new", "new", "path", {:a => "b"}).never
+ @mapper.deprecated_named_route("new", "new", "path", {:a => "b"})
+ end
+end
+
+class RouteSetDeprecatedRouteTest < Test::Unit::TestCase
+ def setup
+ @set = ActionController::Routing::RouteSet.new
+ end
+
+ def test_should_add_deprecated_route
+ @set.expects(:add_named_route).with("old", "path", {:a => "b"})
+ @set.add_deprecated_named_route("new", "old", "path", {:a => "b"})
+ end
+
+ def test_should_fire_deprecation_warning_on_access
+ @set.add_deprecated_named_route("new_outer_inner_path", "outer_new_inner_path", "/outers/:outer_id/inners/new", :controller => :inners)
+ ActiveSupport::Deprecation.expects(:warn)
+ @set.named_routes["outer_new_inner_path"]
+ end
+end
+
end # uses_mocha
class RouteBuilderTest < Test::Unit::TestCase
@@ -1957,4 +1993,4 @@ class RoutingTest < Test::Unit::TestCase
assert c.ancestors.include?(h)
end
-end
+end \ No newline at end of file