Permalink
Browse files

added test for form_for with search_field

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
1 parent 3569bde commit f283812bed8abf187318889c0e889da70446f24b Aditya Sanghi committed with josevalim Oct 2, 2010
Showing with 15 additions and 0 deletions.
  1. +15 −0 actionpack/test/template/form_helper_test.rb
View
15 actionpack/test/template/form_helper_test.rb
@@ -689,6 +689,20 @@ def test_form_for_with_method
assert_dom_equal expected, output_buffer
end
+
+ 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|
+ concat f.search_field(:title)
+ end
+
+ expected = whole_form("/search", "search-post", "new_post") do
+ "<input name='post[title]' size='30' type='search' id='post_title' />"
+ end
+
+ assert_dom_equal expected, output_buffer
+ end
def test_form_for_with_remote
assert_deprecated do
@@ -1781,4 +1795,5 @@ def post_path(post, options = {})
def protect_against_forgery?
false
end
+
end

0 comments on commit f283812

Please sign in to comment.