From dfc1285aad47d33db1004d8e604c093f774f8c37 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 13 Mar 2007 05:12:59 +0000 Subject: Deprecation: remove deprecated link_to_image and link_image_to methods. Use link_to(image_path(...), url). git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6405 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/template/url_helper_test.rb | 57 ++++++++++++----------------- 1 file changed, 24 insertions(+), 33 deletions(-) (limited to 'actionpack/test/template') diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb index 8cef4ffe14..9ecbc77a4e 100644 --- a/actionpack/test/template/url_helper_test.rb +++ b/actionpack/test/template/url_helper_test.rb @@ -17,7 +17,7 @@ class UrlHelperTest < Test::Unit::TestCase @controller = @controller.new @controller.url = "http://www.example.com" end - + def test_url_for_escapes_urls @controller.url = "http://www.example.com?a=b&c=d" assert_equal "http://www.example.com?a=b&c=d", url_for(:a => 'b', :c => 'd') @@ -59,14 +59,14 @@ class UrlHelperTest < Test::Unit::TestCase button_to("Hello", "http://www.example.com", :disabled => true) ) end - + def test_button_to_with_method_delete assert_dom_equal( "
", button_to("Hello", "http://www.example.com", :method => :delete) ) end - + def test_button_to_with_method_get assert_dom_equal( "
", @@ -97,18 +97,18 @@ class UrlHelperTest < Test::Unit::TestCase def test_link_tag_with_custom_onclick assert_dom_equal "Hello", link_to("Hello", "http://www.example.com", :onclick => "alert('yay!')") end - + def test_link_tag_with_javascript_confirm assert_dom_equal( "Hello", link_to("Hello", "http://www.example.com", :confirm => "Are you sure?") ) assert_dom_equal( - "Hello", + "Hello", link_to("Hello", "http://www.example.com", :confirm => "You can't possibly be sure, can you?") ) assert_dom_equal( - "Hello", + "Hello", link_to("Hello", "http://www.example.com", :confirm => "You can't possibly be sure,\n can you?") ) end @@ -119,15 +119,15 @@ class UrlHelperTest < Test::Unit::TestCase link_to("Hello", "http://www.example.com", :popup => true) ) assert_dom_equal( - "Hello", + "Hello", link_to("Hello", "http://www.example.com", :popup => 'true') ) assert_dom_equal( - "Hello", + "Hello", link_to("Hello", "http://www.example.com", :popup => ['window_name', 'width=300,height=300']) ) end - + def test_link_tag_with_popup_and_javascript_confirm assert_dom_equal( "Hello", @@ -138,16 +138,7 @@ class UrlHelperTest < Test::Unit::TestCase link_to("Hello", "http://www.example.com", { :popup => ['window_name', 'width=300,height=300'], :confirm => "Are you serious?" }) ) end - - def test_link_tag_with_post_is_deprecated - assert_deprecated 'post' do - assert_dom_equal( - "Hello", - link_to("Hello", "http://www.example.com", :post => true) - ) - end - end - + def test_link_tag_using_post_javascript assert_dom_equal( "Hello", @@ -161,18 +152,18 @@ class UrlHelperTest < Test::Unit::TestCase link_to("Destroy", "http://www.example.com", :method => :delete) ) end - + def test_link_tag_using_post_javascript_and_confirm assert_dom_equal( "Hello", link_to("Hello", "http://www.example.com", :method => :post, :confirm => "Are you serious?") - ) + ) end - + 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") @@ -182,12 +173,12 @@ class UrlHelperTest < Test::Unit::TestCase } assert_equal "Showing", link_to_unless(true, "Showing", :action => "show", :controller => "weblog", :id => 1) { |name| "#{name}" - } + } assert_equal "test", link_to_unless(true, "Showing", :action => "show", :controller => "weblog", :id => 1) { "test" - } + } end - + def test_link_to_if assert_equal "Showing", link_to_if(false, "Showing", :action => "show", :controller => "weblog") assert_dom_equal "Listing", link_to_if(true, "Listing", :action => "list", :controller => "weblog") @@ -222,14 +213,14 @@ class UrlHelperTest < Test::Unit::TestCase def test_mail_to_with_javascript assert_dom_equal "", mail_to("me@domain.com", "My email", :encode => "javascript") end - + def test_mail_with_options assert_dom_equal( %(My email), mail_to("me@example.com", "My email", :cc => "ccaddress@example.com", :bcc => "bccaddress@example.com", :subject => "This is an example email", :body => "This is the body of the message.") ) end - + def test_mail_to_with_img assert_dom_equal %(), mail_to('feedback@example.com', '') end @@ -257,7 +248,7 @@ class UrlHelperWithControllerTest < Test::Unit::TestCase def show_url_for render :inline => "<%= url_for :controller => 'url_helper_with_controller', :action => 'show_url_for' %>" end - + def show_named_route render :inline => "<%= show_named_route_#{params[:kind]} %>" end @@ -272,26 +263,26 @@ class UrlHelperWithControllerTest < Test::Unit::TestCase @response = ActionController::TestResponse.new @controller = UrlHelperController.new end - + def test_url_for_shows_only_path get :show_url_for assert_equal '/url_helper_with_controller/show_url_for', @response.body end - + def test_named_route_shows_host_and_path with_url_helper_routing do get :show_named_route, :kind => 'url' assert_equal 'http://test.host/url_helper_with_controller/show_named_route', @response.body end end - + def test_named_route_path_shows_only_path with_url_helper_routing do get :show_named_route, :kind => 'path' assert_equal '/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