From 39de84d96739012d2b2d8fd76976bbd798cd2573 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 22 Sep 2007 17:19:26 +0000 Subject: Fixed that setting the :host option in url_for would automatically turn off :only_path (since :host would otherwise not be shown) (closes #9586) [Bounga] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7542 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/template/url_helper_test.rb | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'actionpack/test/template/url_helper_test.rb') diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb index 32696165e9..db1e226a7e 100644 --- a/actionpack/test/template/url_helper_test.rb +++ b/actionpack/test/template/url_helper_test.rb @@ -82,6 +82,24 @@ class UrlHelperTest < Test::Unit::TestCase def test_link_tag_with_straight_url assert_dom_equal "Hello", link_to("Hello", "http://www.example.com") end + + def test_link_tag_without_host_option + ActionController::Base.class_eval { attr_accessor :url } + url = {:controller => 'weblog', :action => 'show'} + @controller = ActionController::Base.new + @controller.request = ActionController::TestRequest.new + @controller.url = ActionController::UrlRewriter.new(@controller.request, url) + assert_dom_equal(%q{Test Link}, link_to('Test Link', url)) + end + + def test_link_tag_with_host_option + ActionController::Base.class_eval { attr_accessor :url } + url = {:controller => 'weblog', :action => 'show', :host => 'www.example.com'} + @controller = ActionController::Base.new + @controller.request = ActionController::TestRequest.new + @controller.url = ActionController::UrlRewriter.new(@controller.request, url) + assert_dom_equal(%q{Test Link}, link_to('Test Link', url)) + end def test_link_tag_with_query assert_dom_equal "Hello", link_to("Hello", "http://www.example.com?q1=v1&q2=v2") @@ -175,7 +193,7 @@ class UrlHelperTest < Test::Unit::TestCase def test_link_tag_using_post_javascript_and_popup assert_raises(ActionView::ActionViewError) { link_to("Hello", "http://www.example.com", :popup => true, :method => :post, :confirm => "Are you serious?") } end - + def test_link_to_unless assert_equal "Showing", link_to_unless(true, "Showing", :action => "show", :controller => "weblog") assert_dom_equal "Listing", link_to_unless(false, "Listing", :action => "list", :controller => "weblog") -- cgit v1.2.3