aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2012-02-22 09:00:53 -0800
committerXavier Noria <fxn@hashref.com>2012-02-22 09:00:53 -0800
commit7f2548e34d79c47ca138ca0378f4a06390c407f1 (patch)
tree4807b806fe8f3cfe30314fc522599b776e4a6d36 /actionpack/test/template
parentf28d9f15482addeb95ab05545b7a8467a4e0182d (diff)
parent002713c64568114f3754799acc0723ea0d442f7a (diff)
downloadrails-7f2548e34d79c47ca138ca0378f4a06390c407f1.tar.gz
rails-7f2548e34d79c47ca138ca0378f4a06390c407f1.tar.bz2
rails-7f2548e34d79c47ca138ca0378f4a06390c407f1.zip
Merge pull request #5130 from dlee/revised_patch_verb
Add config.default_method_for_update to support PATCH
Diffstat (limited to 'actionpack/test/template')
-rw-r--r--actionpack/test/template/form_helper_test.rb9
-rw-r--r--actionpack/test/template/form_tag_helper_test.rb6
2 files changed, 15 insertions, 0 deletions
diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb
index d072d3bce0..e4cb7e02a0 100644
--- a/actionpack/test/template/form_helper_test.rb
+++ b/actionpack/test/template/form_helper_test.rb
@@ -2195,6 +2195,15 @@ class FormHelperTest < ActionView::TestCase
assert_equal expected, output_buffer
end
+ def test_form_for_with_default_method_as_patch
+ ActionView::Base.default_method_for_update = :patch
+ form_for(@post) {}
+ expected = whole_form("/posts/123", "edit_post_123", "edit_post", "patch")
+ assert_dom_equal expected, output_buffer
+ ensure
+ ActionView::Base.default_method_for_update = :put
+ end
+
def test_fields_for_returns_block_result
output = fields_for(Post.new) { |f| "fields" }
assert_equal "fields", output
diff --git a/actionpack/test/template/form_tag_helper_test.rb b/actionpack/test/template/form_tag_helper_test.rb
index 809102e5c2..6ef4cf4dd2 100644
--- a/actionpack/test/template/form_tag_helper_test.rb
+++ b/actionpack/test/template/form_tag_helper_test.rb
@@ -78,6 +78,12 @@ class FormTagHelperTest < ActionView::TestCase
assert_dom_equal expected, actual
end
+ def test_form_tag_with_method_patch
+ actual = form_tag({}, { :method => :patch })
+ expected = whole_form("http://www.example.com", :method => :patch)
+ assert_dom_equal expected, actual
+ end
+
def test_form_tag_with_method_put
actual = form_tag({}, { :method => :put })
expected = whole_form("http://www.example.com", :method => :put)