diff options
author | Tom Lea <contrib@tomlea.co.uk> | 2008-11-01 17:50:16 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-11-01 19:06:25 +0100 |
commit | 5a02f0bccf55191c2cfbcc69bd8165df6d7a2012 (patch) | |
tree | 0cfd350740c346ea518c334511a2058410600080 /actionpack/test/template/url_helper_test.rb | |
parent | 01433af6a5dd5bcd71a70574e7d0b356ba7b0246 (diff) | |
download | rails-5a02f0bccf55191c2cfbcc69bd8165df6d7a2012.tar.gz rails-5a02f0bccf55191c2cfbcc69bd8165df6d7a2012.tar.bz2 rails-5a02f0bccf55191c2cfbcc69bd8165df6d7a2012.zip |
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 <michael@koziarski.com>
Diffstat (limited to 'actionpack/test/template/url_helper_test.rb')
-rw-r--r-- | actionpack/test/template/url_helper_test.rb | 13 |
1 files changed, 13 insertions, 0 deletions
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| |