diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-05-19 09:49:01 -0300 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-05-19 09:58:14 -0300 |
commit | 0e207a499f82c7aefabcddad04fc562df727e663 (patch) | |
tree | fd86ff69d3bfe66f6f7168656347e51c0d8cb309 /actionpack/test/template | |
parent | 3e7070622af7b6efe9eb86c2275b2ad895bd5510 (diff) | |
download | rails-0e207a499f82c7aefabcddad04fc562df727e663.tar.gz rails-0e207a499f82c7aefabcddad04fc562df727e663.tar.bz2 rails-0e207a499f82c7aefabcddad04fc562df727e663.zip |
Clarify grouped_options_for_select method API, add changelog entry
Make the method API more clear by explicitly showing the expected
arguments. This means that the options cannot be passed as second
argument because we are not relying on extract_options! anymore,
you are expected to give a selected key or `nil` if you want to pass
options, as it is the last argument.
Notice that this does not change the current method arguments contract
available in 3.2, it just brings back the same functionality with the
divider addition.
Diffstat (limited to 'actionpack/test/template')
-rw-r--r-- | actionpack/test/template/form_options_helper_test.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/actionpack/test/template/form_options_helper_test.rb b/actionpack/test/template/form_options_helper_test.rb index 9b64bc9d81..2322fb0406 100644 --- a/actionpack/test/template/form_options_helper_test.rb +++ b/actionpack/test/template/form_options_helper_test.rb @@ -300,12 +300,12 @@ class FormOptionsHelperTest < ActionView::TestCase assert_dom_equal( "<optgroup label=\"----------\"><option value=\"US\">US</option>\n<option value=\"Canada\">Canada</option></optgroup><optgroup label=\"----------\"><option value=\"GB\">GB</option>\n<option value=\"Germany\">Germany</option></optgroup>", - grouped_options_for_select([['US',"Canada"] , ["GB", "Germany"]], divider: "----------") + grouped_options_for_select([['US',"Canada"] , ["GB", "Germany"]], nil, divider: "----------") ) end def test_grouped_options_for_select_with_selected_and_prompt_deprecated - assert_deprecated 'Passing the prompt to grouped_options_for_select as an argument is deprecated. Please pass it in an options hash.' do + assert_deprecated 'Passing the prompt to grouped_options_for_select as an argument is deprecated. Please use an options hash like `{ prompt: "Choose a product..." }`.' do assert_dom_equal( "<option value=\"\">Choose a product...</option><optgroup label=\"Hats\"><option value=\"Baseball Cap\">Baseball Cap</option>\n<option selected=\"selected\" value=\"Cowboy Hat\">Cowboy Hat</option></optgroup>", grouped_options_for_select([["Hats", ["Baseball Cap","Cowboy Hat"]]], "Cowboy Hat", "Choose a product...") |