From dfac1cea3d851000116a23ab14c2b1ae981f7a12 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 6 Mar 2005 11:50:41 +0000 Subject: Fixed that form helpers would treat string and symbol keys differently in html_options (and possibly create duplicate entries) #112 [bitsweat] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@833 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../test/template/form_options_helper_test.rb | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'actionpack/test/template/form_options_helper_test.rb') diff --git a/actionpack/test/template/form_options_helper_test.rb b/actionpack/test/template/form_options_helper_test.rb index 4203ab7079..a94f81a728 100644 --- a/actionpack/test/template/form_options_helper_test.rb +++ b/actionpack/test/template/form_options_helper_test.rb @@ -46,7 +46,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase ) end - + def test_collection_options_with_preselected_value @posts = [ Post.new(" went home", "", "To a little house", "shh!"), @@ -75,14 +75,14 @@ class FormOptionsHelperTest < Test::Unit::TestCase def test_array_options_for_select assert_equal( - "\n\n", + "\n\n", options_for_select([ "", "USA", "Sweden" ]) ) end def test_array_options_for_select_with_selection assert_equal( - "\n\n", + "\n\n", options_for_select([ "Denmark", "", "Sweden" ], "") ) end @@ -96,21 +96,21 @@ class FormOptionsHelperTest < Test::Unit::TestCase def test_hash_options_for_select assert_equal( - "\n", + "\n", options_for_select({ "$" => "Dollar", "" => "" }) ) end def test_hash_options_for_select_with_selection assert_equal( - "\n", + "\n", options_for_select({ "$" => "Dollar", "" => "" }, "Dollar") ) end def test_hash_options_for_select_with_selection assert_equal( - "\n", + "\n", options_for_select({ "$" => "Dollar", "" => "" }, [ "Dollar", "" ]) ) end @@ -197,7 +197,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase @post = Post.new @post.category = "" assert_equal( - "", + "", select("post", "category", %w( abe hest)) ) end @@ -206,7 +206,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase @post = Post.new @post.category = "" assert_equal( - "", + "", select("post", "category", %w( abe hest), :include_blank => true) ) end @@ -222,7 +222,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase @post.author_name = "Babe" assert_equal( - "", + "", collection_select("post", "author_name", @posts, "author_name", "author_name") ) end @@ -238,7 +238,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase @post.author_name = "Babe" assert_equal( - "", + "", collection_select("post", "author_name", @posts, "author_name", "author_name", { :include_blank => true }, "style" => "width: 200px") ) end @@ -291,6 +291,8 @@ class FormOptionsHelperTest < Test::Unit::TestCase "" + "", html + assert_equal html, time_zone_select("firm", "time_zone", nil, {}, + :style => "color: red") end def test_time_zone_select_with_blank_and_style @@ -306,6 +308,8 @@ class FormOptionsHelperTest < Test::Unit::TestCase "" + "", html + assert_equal html, time_zone_select("firm", "time_zone", nil, + { :include_blank => true }, :style => "color: red") end def test_time_zone_select_with_priority_zones -- cgit v1.2.3