From 7e3dc807df2193e7bb06b7125d0420d1b05278db Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 7 Sep 2005 12:56:33 +0000 Subject: Added :post option to UrlHelper#link_to that makes it possible to do POST requests through normal ahref links using Javascript git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2149 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/template/url_helper_test.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (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 73d87f6956..185f455777 100644 --- a/actionpack/test/template/url_helper_test.rb +++ b/actionpack/test/template/url_helper_test.rb @@ -88,6 +88,24 @@ class UrlHelperTest < Test::Unit::TestCase ) end + def test_link_tag_using_post_javascript + assert_equal( + "Hello", + link_to("Hello", "http://www.example.com", :post => true) + ) + end + + def test_link_tag_using_post_javascript_and_confirm + assert_equal( + "Hello", + link_to("Hello", "http://www.example.com", :post => true, :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, :post => true, :confirm => "Are you serious?") } + end + def test_link_to_unless assert_equal "Showing", link_to_unless(true, "Showing", :action => "show", :controller => "weblog") assert "Listing", link_to_unless(false, "Listing", :action => "list", :controller => "weblog") -- cgit v1.2.3