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 8d1df88 commit 297cf0b26658ff9c7f19fc703de5bd8939e31d06 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
@@ -761,6 +761,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
form_for(@post, :url => '/', :remote => true, :html => { :id => 'create-post', :method => :put }) do |f|
@@ -1737,4 +1751,5 @@ def test_fields_for_returns_block_result
def protect_against_forgery?
false
end
+
end

0 comments on commit 297cf0b

Please sign in to comment.