diff options
author | Aditya Sanghi <asanghi@me.com> | 2010-10-04 01:05:44 +0530 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-10-12 00:56:07 +0200 |
commit | 582a088ba7f3e720a259f6e01b3fabcda87484b7 (patch) | |
tree | 5410b42a6027a748f8cde0c45fa1837c3527144f /actionpack/test/template/form_tag_helper_test.rb | |
parent | 3eff729079a1a9e717e7872bdae19c8703b280ac (diff) | |
download | rails-582a088ba7f3e720a259f6e01b3fabcda87484b7.tar.gz rails-582a088ba7f3e720a259f6e01b3fabcda87484b7.tar.bz2 rails-582a088ba7f3e720a259f6e01b3fabcda87484b7.zip |
Fix test helpers to ensure get method forms are properly tested [#5753 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/test/template/form_tag_helper_test.rb')
-rw-r--r-- | actionpack/test/template/form_tag_helper_test.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/actionpack/test/template/form_tag_helper_test.rb b/actionpack/test/template/form_tag_helper_test.rb index 8c8e87ae9f..f3933a25b9 100644 --- a/actionpack/test/template/form_tag_helper_test.rb +++ b/actionpack/test/template/form_tag_helper_test.rb @@ -13,19 +13,23 @@ class FormTagHelperTest < ActionView::TestCase txt = %{<div style="margin:0;padding:0;display:inline">} txt << %{<input name="utf8" type="hidden" value="✓" />} - txt << %{<input name="_method" type="hidden" value="#{method}" />} if method + if (method && !['get','post'].include?(method.to_s)) + txt << %{<input name="_method" type="hidden" value="#{method}" />} + end txt << %{</div>} end def form_text(action = "http://www.example.com", options = {}) - remote, enctype, html_class, id = options.values_at(:remote, :enctype, :html_class, :id) + remote, enctype, html_class, id, method = options.values_at(:remote, :enctype, :html_class, :id, :method) + + method = method.to_s == "get" ? "get" : "post" txt = %{<form accept-charset="UTF-8" action="#{action}"} txt << %{ enctype="multipart/form-data"} if enctype txt << %{ data-remote="true"} if remote txt << %{ class="#{html_class}"} if html_class txt << %{ id="#{id}"} if id - txt << %{ method="post">} + txt << %{ method="#{method}">} end def whole_form(action = "http://www.example.com", options = {}) |