diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-03-27 20:01:59 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-03-27 20:01:59 -0300 |
commit | 6968bc16a1a609c56cf056cd9cd8f8de251defde (patch) | |
tree | 6653b5174fe6e925d082f0f19ca9b21ce2a8e56e /actionpack/test | |
parent | 7111133371c08d2096cbcffa661860c9ea2c5813 (diff) | |
download | rails-6968bc16a1a609c56cf056cd9cd8f8de251defde.tar.gz rails-6968bc16a1a609c56cf056cd9cd8f8de251defde.tar.bz2 rails-6968bc16a1a609c56cf056cd9cd8f8de251defde.zip |
Check if the options hash already exists and merge it with the another
hash.
Closes #2492 and #5614
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/template/form_helper_test.rb | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index fc7a37ec07..7eeede7087 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -943,10 +943,25 @@ class FormHelperTest < ActionView::TestCase assert_dom_equal expected, output_buffer end + def test_form_for_label_error_wrapping + form_for(@post) do |f| + concat f.label(:author_name, :class => 'label') + concat f.text_field(:author_name) + concat f.submit('Create post') + end + + expected = whole_form("/posts/123", "edit_post_123" , "edit_post", :method => "put") do + "<div class='field_with_errors'><label for='post_author_name' class='label'>Author name</label></div>" + + "<div class='field_with_errors'><input name='post[author_name]' size='30' type='text' id='post_author_name' value='' /></div>" + + "<input name='commit' type='submit' value='Create post' />" + end + + assert_dom_equal expected, output_buffer + end + + def test_form_for_label_error_wrapping_without_conventional_instance_variable post = remove_instance_variable :@post - default_field_error_proc = ActionView::Base.field_error_proc - ActionView::Base.field_error_proc = Proc.new{ |html_tag, instance| "<div class='error'>#{html_tag}</div>".html_safe } form_for(post) do |f| concat f.label(:author_name, :class => 'label') @@ -955,14 +970,12 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form("/posts/123", "edit_post_123" , "edit_post", :method => "put") do - "<div class='error'><label for='post_author_name' class='label'>Author name</label></div>" + - "<div class='error'><input name='post[author_name]' size='30' type='text' id='post_author_name' value='' /></div>" + + "<div class='field_with_errors'><label for='post_author_name' class='label'>Author name</label></div>" + + "<div class='field_with_errors'><input name='post[author_name]' size='30' type='text' id='post_author_name' value='' /></div>" + "<input name='commit' type='submit' value='Create post' />" end assert_dom_equal expected, output_buffer - ensure - ActionView::Base.field_error_proc = default_field_error_proc end def test_form_for_with_namespace |