aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/form_options_helper_test.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2008-03-20 02:15:29 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2008-03-20 02:15:29 +0000
commit54213dadfde64e163d841056238b3c463aaa4212 (patch)
tree39fe86a2c5e79a1a67008fcbac34acf13caa4c15 /actionpack/test/template/form_options_helper_test.rb
parente87d3e333588b8455c2b6d81219adb860c2f4baa (diff)
downloadrails-54213dadfde64e163d841056238b3c463aaa4212.tar.gz
rails-54213dadfde64e163d841056238b3c463aaa4212.tar.bz2
rails-54213dadfde64e163d841056238b3c463aaa4212.zip
Docfixes (closes #11356, #11172, #10523)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9064 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/template/form_options_helper_test.rb')
-rw-r--r--actionpack/test/template/form_options_helper_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/actionpack/test/template/form_options_helper_test.rb b/actionpack/test/template/form_options_helper_test.rb
index 8ee601f478..f3ecc18233 100644
--- a/actionpack/test/template/form_options_helper_test.rb
+++ b/actionpack/test/template/form_options_helper_test.rb
@@ -31,6 +31,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase
Continent = Struct.new('Continent', :continent_name, :countries)
Country = Struct.new('Country', :country_id, :country_name)
Firm = Struct.new('Firm', :time_zone)
+ Album = Struct.new('Album', :id, :title, :genre)
end
def test_collection_options
@@ -305,6 +306,18 @@ class FormOptionsHelperTest < Test::Unit::TestCase
select("post", "category", %w( abe <mus> hest ), :selected => 'abe')
)
end
+
+ def test_select_with_index_option
+ @album = Album.new
+ @album.id = 1
+
+ expected = "<select id=\"album__genre\" name=\"album[][genre]\"><option value=\"rap\">rap</option>\n<option value=\"rock\">rock</option>\n<option value=\"country\">country</option></select>"
+
+ assert_dom_equal(
+ expected,
+ select("album[]", "genre", %w[rap rock country], {}, { :index => nil })
+ )
+ end
def test_select_with_selected_nil
@post = Post.new