diff options
author | Gabe da Silveira <gabe@websaviour.com> | 2008-11-14 01:14:02 -0800 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-11-18 22:47:33 +0100 |
commit | 917428bcce7bb22241bfc07daa5d0ddf9d107775 (patch) | |
tree | 9deaed010588026d1f7ee4dd93b4401ed26c7b20 /actionpack/test/controller | |
parent | 60d6f255177af3ca93721abb8551c8585fc8c67d (diff) | |
download | rails-917428bcce7bb22241bfc07daa5d0ddf9d107775.tar.gz rails-917428bcce7bb22241bfc07daa5d0ddf9d107775.tar.bz2 rails-917428bcce7bb22241bfc07daa5d0ddf9d107775.zip |
Make optimized named routes respect all reserved options and tie it into UrlRewriter::RESERVED_OPTIONS so it's DRY
Signed-off-by: Michael Koziarski <michael@koziarski.com>
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/routing_test.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index 9699a04abb..b8a143cfd9 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -706,12 +706,13 @@ uses_mocha 'LegacyRouteSet, Route, RouteSet and RouteLoading' do port = options.delete(:port) || 80 port_string = port == 80 ? '' : ":#{port}" - host = options.delete(:host) || "named.route.test" - anchor = "##{options.delete(:anchor)}" if options.key?(:anchor) + protocol = options.delete(:protocol) || "http" + host = options.delete(:host) || "named.route.test" + anchor = "##{options.delete(:anchor)}" if options.key?(:anchor) path = routes.generate(options) - only_path ? "#{path}#{anchor}" : "http://#{host}#{port_string}#{path}#{anchor}" + only_path ? "#{path}#{anchor}" : "#{protocol}://#{host}#{port_string}#{path}#{anchor}" end def request @@ -1726,6 +1727,11 @@ uses_mocha 'LegacyRouteSet, Route, RouteSet and RouteLoading' do assert_equal "http://some.example.com/people/5", controller.send(:show_url, 5, :host=>"some.example.com") end + def test_named_route_url_method_with_protocol + controller = setup_named_route_test + assert_equal "https://named.route.test/people/5", controller.send(:show_url, 5, :protocol => "https") + end + def test_named_route_url_method_with_ordered_parameters controller = setup_named_route_test assert_equal "http://named.route.test/people/go/7/hello/joe/5", |