aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-05-28 23:39:37 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-05-28 23:39:37 +0000
commit140a998de31ed4547e0d21715165f4b338030673 (patch)
tree99b1b2d145cfef351ce49d06e9cda1c459ed404a /actionpack/test
parentd84ba8b8a93330fbd893b809284d3f21c8eb1177 (diff)
downloadrails-140a998de31ed4547e0d21715165f4b338030673.tar.gz
rails-140a998de31ed4547e0d21715165f4b338030673.tar.bz2
rails-140a998de31ed4547e0d21715165f4b338030673.zip
Added :method handling for other verbs to remote_form_tag and remote_form_for [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4374 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/template/prototype_helper_test.rb20
1 files changed, 15 insertions, 5 deletions
diff --git a/actionpack/test/template/prototype_helper_test.rb b/actionpack/test/template/prototype_helper_test.rb
index ceeb418e34..56b1ed263c 100644
--- a/actionpack/test/template/prototype_helper_test.rb
+++ b/actionpack/test/template/prototype_helper_test.rb
@@ -8,17 +8,22 @@ module BaseTest
include ActionView::Helpers::UrlHelper
include ActionView::Helpers::TagHelper
include ActionView::Helpers::TextHelper
+ include ActionView::Helpers::FormTagHelper
include ActionView::Helpers::FormHelper
include ActionView::Helpers::CaptureHelper
def setup
@controller = Class.new do
def url_for(options, *parameters_for_method_reference)
- url = "http://www.example.com/"
- url << options[:action].to_s if options and options[:action]
- url << "?a=#{options[:a]}" if options && options[:a]
- url << "&b=#{options[:b]}" if options && options[:a] && options[:b]
- url
+ if options.is_a?(String)
+ options
+ else
+ url = "http://www.example.com/"
+ url << options[:action].to_s if options and options[:action]
+ url << "?a=#{options[:a]}" if options && options[:a]
+ url << "&b=#{options[:b]}" if options && options[:a] && options[:b]
+ url
+ end
end
end.new
end
@@ -61,6 +66,11 @@ class PrototypeHelperTest < Test::Unit::TestCase
assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater({success:'glass_of_beer',failure:'glass_of_water'}, 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;\">),
form_remote_tag(:update => { :success => 'glass_of_beer', :failure => "glass_of_water" }, :url => { :action => :fast })
end
+
+ def test_form_remote_tag_with_method
+ assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;\"><input name='_method' type='hidden' value='put' />),
+ form_remote_tag(:update => "glass_of_beer", :url => { :action => :fast }, :html => { :method => :put })
+ end
def test_on_callbacks
callbacks = [:uninitialized, :loading, :loaded, :interactive, :complete, :success, :failure]