From 938d130c62b530d3445c9f06933cb113ff477fed Mon Sep 17 00:00:00 2001 From: Godfrey Chan Date: Sun, 23 Nov 2014 01:08:53 -0800 Subject: [PATCH] Fix cases where the wrong name is passed to `Formatter#generate` These are currently working "by accident" because `match_route` does not check that the name is valid. --- actionpack/test/controller/routing_test.rb | 2 +- actionpack/test/journey/router_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index aca9f0374842d..f46b32e0197c8 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -1386,7 +1386,7 @@ def test_named_routes_are_never_relative_to_modules url = controller.url_for({ :controller => "connection", :only_path => true }) assert_equal "/connection/connection", url - url = controller.url_for({ :use_route => :family_connection, + url = controller.url_for({ :use_route => "family_connection", :controller => "connection", :only_path => true }) assert_equal "/connection", url end diff --git a/actionpack/test/journey/router_test.rb b/actionpack/test/journey/router_test.rb index fbac86e8ca693..19c61b591475b 100644 --- a/actionpack/test/journey/router_test.rb +++ b/actionpack/test/journey/router_test.rb @@ -415,7 +415,7 @@ def test_generate_uses_recall_if_needed def test_generate_with_name path = Path::Pattern.from_string '/:controller(/:action)' - @router.routes.add_route @app, path, {}, {}, {} + @router.routes.add_route @app, path, {}, {}, "tasks" path, params = @formatter.generate( "tasks",