diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index 0bfdbeebd1..acb6e7aa64 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -735,11 +735,11 @@ class FormHelperTest < ActionView::TestCase def test_form_for_with_search_field # Test case for bug which would emit an "object" attribute # when used with form_for using a search_field form helper - form_for(Post.new, :url => "/search", :html => { :id => 'search-post' }) do |f| + form_for(Post.new, :url => "/search", :html => { :id => 'search-post', :method => :get}) do |f| concat f.search_field(:title) end - expected = whole_form("/search", "search-post", "new_post") do + expected = whole_form("/search", "search-post", "new_post", "get") do "" end @@ -1528,17 +1528,20 @@ class FormHelperTest < ActionView::TestCase def snowman(method = nil) txt = %{
} txt << %{} - txt << %{} if method + if (method && !['get','post'].include?(method.to_s)) + txt << %{} + end txt << %{
} end - def form_text(action = "/", id = nil, html_class = nil, remote = nil, multipart = nil) + def form_text(action = "/", id = nil, html_class = nil, remote = nil, multipart = nil, method = nil) txt = %{
} + method = method.to_s == "get" ? "get" : "post" + txt << %{ method="#{method}">} end def whole_form(action = "/", id = nil, html_class = nil, options = nil) @@ -1550,7 +1553,7 @@ class FormHelperTest < ActionView::TestCase method = options end - form_text(action, id, html_class, remote, multipart) + snowman(method) + contents + "
" + form_text(action, id, html_class, remote, multipart, method) + snowman(method) + contents + "" end def test_default_form_builder 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 = %{
} txt << %{} - txt << %{} if method + if (method && !['get','post'].include?(method.to_s)) + txt << %{} + end txt << %{
} 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 = %{
} + txt << %{ method="#{method}">} end def whole_form(action = "http://www.example.com", options = {})