diff options
Diffstat (limited to 'actionpack/test/template/form_helper_test.rb')
-rw-r--r-- | actionpack/test/template/form_helper_test.rb | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index ad876df65d..73b936b16e 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -3,6 +3,8 @@ require 'controller/fake_models' require 'active_support/core_ext/object/inclusion' class FormHelperTest < ActionView::TestCase + include RenderERBUtils + tests ActionView::Helpers::FormHelper def form_for(*) @@ -231,9 +233,6 @@ class FormHelperTest < ActionView::TestCase end def test_label_with_block_in_erb - path = ActionView::FileSystemResolver.new(FIXTURE_LOAD_PATH) - view_paths = ActionView::PathSet.new([path]) - view = ActionView::Base.new(view_paths) assert_equal "<label for=\"post_message\">\n Message\n <input id=\"post_message\" name=\"post[message]\" size=\"30\" type=\"text\" />\n</label>", view.render("test/label_with_block") end @@ -690,6 +689,7 @@ class FormHelperTest < ActionView::TestCase concat f.text_area(:body) concat f.check_box(:secret) concat f.submit('Create post') + concat f.button('Create post') end expected = whole_form("/posts/123", "create-post" , "edit_post", :method => "put") do @@ -698,7 +698,8 @@ class FormHelperTest < ActionView::TestCase "<textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" + "<input name='post[secret]' type='hidden' value='0' />" + "<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />" + - "<input name='commit' type='submit' value='Create post' />" + "<input name='commit' type='submit' value='Create post' />" + + "<button name='button' type='submit'>Create post</button>" end assert_dom_equal expected, output_buffer @@ -770,7 +771,7 @@ class FormHelperTest < ActionView::TestCase concat f.submit('Create post') end - expected = whole_form("/posts/123", "create-post", "other_name_edit", :method => "put") do + expected = whole_form("/posts/123", "create-post", "edit_other_name", :method => "put") do "<label for='other_name_title' class='post_title'>Title</label>" + "<input name='other_name[title]' size='30' id='other_name_title' value='Hello World' type='text' />" + "<textarea name='other_name[body]' id='other_name_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" + @@ -907,7 +908,7 @@ class FormHelperTest < ActionView::TestCase concat f.check_box(:secret) end - expected = whole_form('/posts/123', 'post[]_edit', 'post[]_edit', 'put') do + expected = whole_form('/posts/123', 'edit_post[]', 'edit_post[]', 'put') do "<label for='post_123_title'>Title</label>" + "<input name='post[123][title]' size='30' type='text' id='post_123_title' value='Hello World' />" + "<textarea name='post[123][body]' id='post_123_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" + @@ -925,7 +926,7 @@ class FormHelperTest < ActionView::TestCase concat f.check_box(:secret) end - expected = whole_form('/posts/123', 'post[]_edit', 'post[]_edit', 'put') do + expected = whole_form('/posts/123', 'edit_post[]', 'edit_post[]', 'put') do "<input name='post[][title]' size='30' type='text' id='post__title' value='Hello World' />" + "<textarea name='post[][body]' id='post__body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" + "<input name='post[][secret]' type='hidden' value='0' />" + @@ -1067,7 +1068,7 @@ class FormHelperTest < ActionView::TestCase concat f.submit end - expected = whole_form('/posts/123', 'another_post_edit', 'another_post_edit', :method => 'put') do + expected = whole_form('/posts/123', 'edit_another_post', 'edit_another_post', :method => 'put') do "<input name='commit' type='submit' value='Update your Post' />" end @@ -1099,7 +1100,7 @@ class FormHelperTest < ActionView::TestCase } end - expected = whole_form('/posts/123', 'post[]_edit', 'post[]_edit', 'put') do + expected = whole_form('/posts/123', 'edit_post[]', 'edit_post[]', 'put') do "<input name='post[123][title]' size='30' type='text' id='post_123_title' value='Hello World' />" + "<input name='post[123][comment][][name]' size='30' type='text' id='post_123_comment__name' value='new comment' />" end @@ -1158,7 +1159,7 @@ class FormHelperTest < ActionView::TestCase } end - expected = whole_form('/posts/123', 'post[]_edit', 'post[]_edit', 'put') do + expected = whole_form('/posts/123', 'edit_post[]', 'edit_post[]', 'put') do "<input name='post[123][comment][title]' size='30' type='text' id='post_123_comment_title' value='Hello World' />" end @@ -1186,7 +1187,7 @@ class FormHelperTest < ActionView::TestCase } end - expected = whole_form('/posts/123', 'post[]_edit', 'post[]_edit', 'put') do + expected = whole_form('/posts/123', 'edit_post[]', 'edit_post[]', 'put') do "<input name='post[123][comment][123][title]' size='30' type='text' id='post_123_comment_123_title' value='Hello World' />" end @@ -1206,9 +1207,9 @@ class FormHelperTest < ActionView::TestCase } end - expected = whole_form('/posts/123', 'post[]_edit', 'post[]_edit', 'put') do + expected = whole_form('/posts/123', 'edit_post[]', 'edit_post[]', 'put') do "<input name='post[123][comment][5][title]' size='30' type='text' id='post_123_comment_5_title' value='Hello World' />" - end + whole_form('/posts/123', 'post_edit', 'post_edit', 'put') do + end + whole_form('/posts/123', 'edit_post', 'edit_post', 'put') do "<input name='post[1][comment][123][title]' size='30' type='text' id='post_1_comment_123_title' value='Hello World' />" end @@ -1861,7 +1862,7 @@ class FormHelperTest < ActionView::TestCase } end - expected = whole_form('/posts/123', 'create-post', 'post_edit', :method => 'put') do + expected = whole_form('/posts/123', 'create-post', 'edit_post', :method => 'put') do "<input name='post[title]' size='30' type='text' id='post_title' value='Hello World' />" + "<textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" + "<input name='parent_post[secret]' type='hidden' value='0' />" + @@ -1881,7 +1882,7 @@ class FormHelperTest < ActionView::TestCase } end - expected = whole_form('/posts/123', 'create-post', 'post_edit', :method => 'put') do + expected = whole_form('/posts/123', 'create-post', 'edit_post', :method => 'put') do "<input name='post[title]' size='30' type='text' id='post_title' value='Hello World' />" + "<textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" + "<input name='post[comment][name]' type='text' id='post_comment_name' value='new comment' size='30' />" |