diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2011-05-14 20:58:02 -0300 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2011-05-14 22:09:12 -0300 |
commit | f0479cbbd52961c75906022003d4f03aa39556e0 (patch) | |
tree | e1461f7d903d84ba30bad95ed3686ff7fe949c4c /actionpack/test/template | |
parent | 6871cda693a9a3e5d26ab0884f19132064acbf0a (diff) | |
download | rails-f0479cbbd52961c75906022003d4f03aa39556e0.tar.gz rails-f0479cbbd52961c75906022003d4f03aa39556e0.tar.bz2 rails-f0479cbbd52961c75906022003d4f03aa39556e0.zip |
Refactor fields_for to make the api more clear, and fix usage with non nested attributes and without object
Diffstat (limited to 'actionpack/test/template')
-rw-r--r-- | actionpack/test/template/form_helper_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index c25c850eb3..286bfb4d04 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -1725,6 +1725,20 @@ class FormHelperTest < ActionView::TestCase assert_dom_equal expected, output_buffer end + def test_form_for_and_fields_for_with_non_nested_association_and_without_object + form_for(@post) do |f| + concat f.fields_for(:category) { |c| + concat c.text_field(:name) + } + end + + expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', 'put') do + "<input name='post[category][name]' type='text' size='30' id='post_category_name' />" + end + + assert_dom_equal expected, output_buffer + end + class LabelledFormBuilder < ActionView::Helpers::FormBuilder (field_helpers - %w(hidden_field)).each do |selector| class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 |