From 5a02f0bccf55191c2cfbcc69bd8165df6d7a2012 Mon Sep 17 00:00:00 2001 From: Tom Lea Date: Sat, 1 Nov 2008 17:50:16 +0000 Subject: Cleaned up route optimisation guard condition generation code as it was getting a little messy. Add additional condition to handle the case where default_url_options is only defined in the controller, not the view. Signed-off-by: Michael Koziarski --- actionpack/test/template/url_helper_test.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'actionpack/test/template') diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb index 797b74efe6..2f6fa134b5 100644 --- a/actionpack/test/template/url_helper_test.rb +++ b/actionpack/test/template/url_helper_test.rb @@ -376,6 +376,19 @@ class UrlHelperWithControllerTest < ActionView::TestCase assert_equal '/url_helper_with_controller/nil_url_for', @response.body end + def test_named_route_should_show_host_and_path_using_controller_default_url_options + class << @controller + def default_url_options(options = nil) + {:host => 'testtwo.host'} + end + end + + with_url_helper_routing do + get :show_named_route, :kind => 'url' + assert_equal 'http://testtwo.host/url_helper_with_controller/show_named_route', @response.body + end + end + protected def with_url_helper_routing with_routing do |set| -- cgit v1.2.3