diff options
author | Sven Fuchs <svenfuchs@artweb-design.de> | 2008-07-16 11:30:57 -0700 |
---|---|---|
committer | Sven Fuchs <svenfuchs@artweb-design.de> | 2008-07-16 11:30:57 -0700 |
commit | 842917dea0cfdf70f158a312cc1f77f769791d8c (patch) | |
tree | 3a66555996dee9a7242027b10d85a3050582470a | |
parent | 428b77debdab27c0bd73ec87bda8914d6acdfd3e (diff) | |
download | rails-842917dea0cfdf70f158a312cc1f77f769791d8c.tar.gz rails-842917dea0cfdf70f158a312cc1f77f769791d8c.tar.bz2 rails-842917dea0cfdf70f158a312cc1f77f769791d8c.zip |
moving country helpers from form_options_helper to form_country_helper again
4 files changed, 791 insertions, 1620 deletions
diff --git a/actionpack/lib/action_view/helpers/form_country_helper.rb b/actionpack/lib/action_view/helpers/form_country_helper.rb index b2d2b7741f..84e811f61d 100644 --- a/actionpack/lib/action_view/helpers/form_country_helper.rb +++ b/actionpack/lib/action_view/helpers/form_country_helper.rb @@ -3,9 +3,10 @@ require 'action_view/helpers/form_options_helper' module ActionView module Helpers module FormCountryHelper + # Return select and option tags for the given object and method, using country_options_for_select to generate the list of option tags. def country_select(object, method, priority_countries = nil, options = {}, html_options = {}) - InstanceTag.new(object, method, self, nil, options.delete(:object)).to_country_select_tag(priority_countries, options, html_options) + InstanceTag.new(object, method, self, options.delete(:object)).to_country_select_tag(priority_countries, options, html_options) end # Returns a string of option tags for pretty much any country in the world. Supply a country name as +selected+ to @@ -15,17 +16,17 @@ module ActionView # NOTE: Only the option tags are returned, you have to wrap this call in a regular HTML select tag. def country_options_for_select(selected = nil, priority_countries = nil) country_options = "" - + if priority_countries country_options += options_for_select(priority_countries, selected) country_options += "<option value=\"\" disabled=\"disabled\">-------------</option>\n" end - + return country_options + options_for_select(COUNTRIES, selected) end private - + # All the countries included in the country_options output. COUNTRIES = ["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", @@ -63,8 +64,7 @@ module ActionView "Turks and Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan", "Vanuatu", "Venezuela", "Viet Nam", "Virgin Islands, British", "Virgin Islands, U.S.", "Wallis and Futuna", "Western Sahara", - "Yemen", "Zambia", "Zimbabwe"] unless const_defined?("COUNTRIES") - + "Yemen", "Zambia", "Zimbabwe"] unless const_defined?("COUNTRIES") end class InstanceTag #:nodoc: @@ -80,7 +80,13 @@ module ActionView options, value ), html_options ) - end + end + end + + class FormBuilder + def country_select(method, priority_countries = nil, options = {}, html_options = {}) + @template.country_select(@object_name, method, priority_countries, objectify_options(options), @default_options.merge(html_options)) + end end end end
\ No newline at end of file diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index 87d49397c6..9aae945408 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -133,11 +133,6 @@ module ActionView InstanceTag.new(object, method, self, options.delete(:object)).to_collection_select_tag(collection, value_method, text_method, options, html_options) end - # Return select and option tags for the given object and method, using country_options_for_select to generate the list of option tags. - def country_select(object, method, priority_countries = nil, options = {}, html_options = {}) - InstanceTag.new(object, method, self, options.delete(:object)).to_country_select_tag(priority_countries, options, html_options) - end - # Return select and option tags for the given object and method, using # #time_zone_options_for_select to generate the list of option tags. # @@ -274,22 +269,6 @@ module ActionView end end - # Returns a string of option tags for pretty much any country in the world. Supply a country name as +selected+ to - # have it marked as the selected option tag. You can also supply an array of countries as +priority_countries+, so - # that they will be listed above the rest of the (long) list. - # - # NOTE: Only the option tags are returned, you have to wrap this call in a regular HTML select tag. - def country_options_for_select(selected = nil, priority_countries = nil) - country_options = "" - - if priority_countries - country_options += options_for_select(priority_countries, selected) - country_options += "<option value=\"\" disabled=\"disabled\">-------------</option>\n" - end - - return country_options + options_for_select(COUNTRIES, selected) - end - # Returns a string of option tags for pretty much any time zone in the # world. Supply a TimeZone name as +selected+ to have it marked as the # selected option tag. You can also supply an array of TimeZone objects @@ -347,43 +326,7 @@ module ActionView end # All the countries included in the country_options output. - COUNTRIES = ["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", - "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", - "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", - "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegowina", "Botswana", "Bouvet Island", "Brazil", - "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", - "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", - "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", - "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba", - "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "Ecuador", "Egypt", - "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands (Malvinas)", - "Faroe Islands", "Fiji", "Finland", "France", "French Guiana", "French Polynesia", - "French Southern Territories", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guernsey", "Guinea", - "Guinea-Bissau", "Guyana", "Haiti", "Heard and McDonald Islands", "Holy See (Vatican City State)", - "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran, Islamic Republic of", "Iraq", - "Ireland", "Isle of Man", "Israel", "Italy", "Jamaica", "Japan", "Jersey", "Jordan", "Kazakhstan", "Kenya", - "Kiribati", "Korea, Democratic People's Republic of", "Korea, Republic of", "Kuwait", "Kyrgyzstan", - "Lao People's Democratic Republic", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libyan Arab Jamahiriya", - "Liechtenstein", "Lithuania", "Luxembourg", "Macao", "Macedonia, The Former Yugoslav Republic Of", - "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Martinique", - "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia, Federated States of", "Moldova, Republic of", - "Monaco", "Mongolia", "Montenegro", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", - "Nepal", "Netherlands", "Netherlands Antilles", "New Caledonia", "New Zealand", "Nicaragua", "Niger", - "Nigeria", "Niue", "Norfolk Island", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau", - "Palestinian Territory, Occupied", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", - "Pitcairn", "Poland", "Portugal", "Puerto Rico", "Qatar", "Reunion", "Romania", "Russian Federation", - "Rwanda", "Saint Barthelemy", "Saint Helena", "Saint Kitts and Nevis", "Saint Lucia", - "Saint Pierre and Miquelon", "Saint Vincent and the Grenadines", "Samoa", "San Marino", - "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Singapore", - "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", - "South Georgia and the South Sandwich Islands", "Spain", "Sri Lanka", "Sudan", "Suriname", - "Svalbard and Jan Mayen", "Swaziland", "Sweden", "Switzerland", "Syrian Arab Republic", - "Taiwan, Province of China", "Tajikistan", "Tanzania, United Republic of", "Thailand", "Timor-Leste", - "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", - "Turks and Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", - "United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan", "Vanuatu", "Venezuela", - "Viet Nam", "Virgin Islands, British", "Virgin Islands, U.S.", "Wallis and Futuna", "Western Sahara", - "Yemen", "Zambia", "Zimbabwe"] unless const_defined?("COUNTRIES") + COUNTRIES = ActiveSupport::Deprecation::DeprecatedConstantProxy.new 'COUNTRIES', 'ActionView::Helpers::FormCountryHelper::COUNTRIES' end class InstanceTag #:nodoc: @@ -406,18 +349,6 @@ module ActionView ) end - def to_country_select_tag(priority_countries, options, html_options) - html_options = html_options.stringify_keys - add_default_name_and_id(html_options) - value = value(object) - content_tag("select", - add_options( - country_options_for_select(value, priority_countries), - options, value - ), html_options - ) - end - def to_time_zone_select_tag(priority_zones, options, html_options) html_options = html_options.stringify_keys add_default_name_and_id(html_options) @@ -452,10 +383,6 @@ module ActionView @template.collection_select(@object_name, method, collection, value_method, text_method, objectify_options(options), @default_options.merge(html_options)) end - def country_select(method, priority_countries = nil, options = {}, html_options = {}) - @template.country_select(@object_name, method, priority_countries, objectify_options(options), @default_options.merge(html_options)) - end - def time_zone_select(method, priority_zones = nil, options = {}, html_options = {}) @template.time_zone_select(@object_name, method, priority_zones, objectify_options(options), @default_options.merge(html_options)) end diff --git a/actionpack/test/template/form_country_helper_test.rb b/actionpack/test/template/form_country_helper_test.rb index 224b2e21c2..8862e08222 100644 --- a/actionpack/test/template/form_country_helper_test.rb +++ b/actionpack/test/template/form_country_helper_test.rb @@ -769,4 +769,781 @@ COUNTRIES COUNTRIES assert_dom_equal(expected_select[0..-2], country_select("post", "origin", ["New Zealand", "Nicaragua"])) end + + def test_country_select_under_fields_for + @post = Post.new + @post.origin = "Australia" + expected_select = <<-COUNTRIES +<select id="post_origin" name="post[origin]"><option value="Afghanistan">Afghanistan</option> +<option value="Aland Islands">Aland Islands</option> +<option value="Albania">Albania</option> +<option value="Algeria">Algeria</option> +<option value="American Samoa">American Samoa</option> +<option value="Andorra">Andorra</option> +<option value="Angola">Angola</option> +<option value="Anguilla">Anguilla</option> +<option value="Antarctica">Antarctica</option> +<option value="Antigua And Barbuda">Antigua And Barbuda</option> +<option value="Argentina">Argentina</option> +<option value="Armenia">Armenia</option> +<option value="Aruba">Aruba</option> +<option selected="selected" value="Australia">Australia</option> +<option value="Austria">Austria</option> +<option value="Azerbaijan">Azerbaijan</option> +<option value="Bahamas">Bahamas</option> +<option value="Bahrain">Bahrain</option> +<option value="Bangladesh">Bangladesh</option> +<option value="Barbados">Barbados</option> +<option value="Belarus">Belarus</option> +<option value="Belgium">Belgium</option> +<option value="Belize">Belize</option> +<option value="Benin">Benin</option> +<option value="Bermuda">Bermuda</option> +<option value="Bhutan">Bhutan</option> +<option value="Bolivia">Bolivia</option> +<option value="Bosnia and Herzegowina">Bosnia and Herzegowina</option> +<option value="Botswana">Botswana</option> +<option value="Bouvet Island">Bouvet Island</option> +<option value="Brazil">Brazil</option> +<option value="British Indian Ocean Territory">British Indian Ocean Territory</option> +<option value="Brunei Darussalam">Brunei Darussalam</option> +<option value="Bulgaria">Bulgaria</option> +<option value="Burkina Faso">Burkina Faso</option> +<option value="Burundi">Burundi</option> +<option value="Cambodia">Cambodia</option> +<option value="Cameroon">Cameroon</option> +<option value="Canada">Canada</option> +<option value="Cape Verde">Cape Verde</option> +<option value="Cayman Islands">Cayman Islands</option> +<option value="Central African Republic">Central African Republic</option> +<option value="Chad">Chad</option> +<option value="Chile">Chile</option> +<option value="China">China</option> +<option value="Christmas Island">Christmas Island</option> +<option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option> +<option value="Colombia">Colombia</option> +<option value="Comoros">Comoros</option> +<option value="Congo">Congo</option> +<option value="Congo, the Democratic Republic of the">Congo, the Democratic Republic of the</option> +<option value="Cook Islands">Cook Islands</option> +<option value="Costa Rica">Costa Rica</option> +<option value="Cote d'Ivoire">Cote d'Ivoire</option> +<option value="Croatia">Croatia</option> +<option value="Cuba">Cuba</option> +<option value="Cyprus">Cyprus</option> +<option value="Czech Republic">Czech Republic</option> +<option value="Denmark">Denmark</option> +<option value="Djibouti">Djibouti</option> +<option value="Dominica">Dominica</option> +<option value="Dominican Republic">Dominican Republic</option> +<option value="Ecuador">Ecuador</option> +<option value="Egypt">Egypt</option> +<option value="El Salvador">El Salvador</option> +<option value="Equatorial Guinea">Equatorial Guinea</option> +<option value="Eritrea">Eritrea</option> +<option value="Estonia">Estonia</option> +<option value="Ethiopia">Ethiopia</option> +<option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option> +<option value="Faroe Islands">Faroe Islands</option> +<option value="Fiji">Fiji</option> +<option value="Finland">Finland</option> +<option value="France">France</option> +<option value="French Guiana">French Guiana</option> +<option value="French Polynesia">French Polynesia</option> +<option value="French Southern Territories">French Southern Territories</option> +<option value="Gabon">Gabon</option> +<option value="Gambia">Gambia</option> +<option value="Georgia">Georgia</option> +<option value="Germany">Germany</option> +<option value="Ghana">Ghana</option> +<option value="Gibraltar">Gibraltar</option> +<option value="Greece">Greece</option> +<option value="Greenland">Greenland</option> +<option value="Grenada">Grenada</option> +<option value="Guadeloupe">Guadeloupe</option> +<option value="Guam">Guam</option> +<option value="Guatemala">Guatemala</option> +<option value="Guernsey">Guernsey</option> +<option value="Guinea">Guinea</option> +<option value="Guinea-Bissau">Guinea-Bissau</option> +<option value="Guyana">Guyana</option> +<option value="Haiti">Haiti</option> +<option value="Heard and McDonald Islands">Heard and McDonald Islands</option> +<option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option> +<option value="Honduras">Honduras</option> +<option value="Hong Kong">Hong Kong</option> +<option value="Hungary">Hungary</option> +<option value="Iceland">Iceland</option> +<option value="India">India</option> +<option value="Indonesia">Indonesia</option> +<option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option> +<option value="Iraq">Iraq</option> +<option value="Ireland">Ireland</option> +<option value="Isle of Man">Isle of Man</option> +<option value="Israel">Israel</option> +<option value="Italy">Italy</option> +<option value="Jamaica">Jamaica</option> +<option value="Japan">Japan</option> +<option value="Jersey">Jersey</option> +<option value="Jordan">Jordan</option> +<option value="Kazakhstan">Kazakhstan</option> +<option value="Kenya">Kenya</option> +<option value="Kiribati">Kiribati</option> +<option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option> +<option value="Korea, Republic of">Korea, Republic of</option> +<option value="Kuwait">Kuwait</option> +<option value="Kyrgyzstan">Kyrgyzstan</option> +<option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option> +<option value="Latvia">Latvia</option> +<option value="Lebanon">Lebanon</option> +<option value="Lesotho">Lesotho</option> +<option value="Liberia">Liberia</option> +<option value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</option> +<option value="Liechtenstein">Liechtenstein</option> +<option value="Lithuania">Lithuania</option> +<option value="Luxembourg">Luxembourg</option> +<option value="Macao">Macao</option> +<option value="Macedonia, The Former Yugoslav Republic Of">Macedonia, The Former Yugoslav Republic Of</option> +<option value="Madagascar">Madagascar</option> +<option value="Malawi">Malawi</option> +<option value="Malaysia">Malaysia</option> +<option value="Maldives">Maldives</option> +<option value="Mali">Mali</option> +<option value="Malta">Malta</option> +<option value="Marshall Islands">Marshall Islands</option> +<option value="Martinique">Martinique</option> +<option value="Mauritania">Mauritania</option> +<option value="Mauritius">Mauritius</option> +<option value="Mayotte">Mayotte</option> +<option value="Mexico">Mexico</option> +<option value="Micronesia, Federated States of">Micronesia, Federated States of</option> +<option value="Moldova, Republic of">Moldova, Republic of</option> +<option value="Monaco">Monaco</option> +<option value="Mongolia">Mongolia</option> +<option value="Montenegro">Montenegro</option> +<option value="Montserrat">Montserrat</option> +<option value="Morocco">Morocco</option> +<option value="Mozambique">Mozambique</option> +<option value="Myanmar">Myanmar</option> +<option value="Namibia">Namibia</option> +<option value="Nauru">Nauru</option> +<option value="Nepal">Nepal</option> +<option value="Netherlands">Netherlands</option> +<option value="Netherlands Antilles">Netherlands Antilles</option> +<option value="New Caledonia">New Caledonia</option> +<option value="New Zealand">New Zealand</option> +<option value="Nicaragua">Nicaragua</option> +<option value="Niger">Niger</option> +<option value="Nigeria">Nigeria</option> +<option value="Niue">Niue</option> +<option value="Norfolk Island">Norfolk Island</option> +<option value="Northern Mariana Islands">Northern Mariana Islands</option> +<option value="Norway">Norway</option> +<option value="Oman">Oman</option> +<option value="Pakistan">Pakistan</option> +<option value="Palau">Palau</option> +<option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option> +<option value="Panama">Panama</option> +<option value="Papua New Guinea">Papua New Guinea</option> +<option value="Paraguay">Paraguay</option> +<option value="Peru">Peru</option> +<option value="Philippines">Philippines</option> +<option value="Pitcairn">Pitcairn</option> +<option value="Poland">Poland</option> +<option value="Portugal">Portugal</option> +<option value="Puerto Rico">Puerto Rico</option> +<option value="Qatar">Qatar</option> +<option value="Reunion">Reunion</option> +<option value="Romania">Romania</option> +<option value="Russian Federation">Russian Federation</option> +<option value="Rwanda">Rwanda</option> +<option value="Saint Barthelemy">Saint Barthelemy</option> +<option value="Saint Helena">Saint Helena</option> +<option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option> +<option value="Saint Lucia">Saint Lucia</option> +<option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option> +<option value="Saint Vincent and the Grenadines">Saint Vincent and the Grenadines</option> +<option value="Samoa">Samoa</option> +<option value="San Marino">San Marino</option> +<option value="Sao Tome and Principe">Sao Tome and Principe</option> +<option value="Saudi Arabia">Saudi Arabia</option> +<option value="Senegal">Senegal</option> +<option value="Serbia">Serbia</option> +<option value="Seychelles">Seychelles</option> +<option value="Sierra Leone">Sierra Leone</option> +<option value="Singapore">Singapore</option> +<option value="Slovakia">Slovakia</option> +<option value="Slovenia">Slovenia</option> +<option value="Solomon Islands">Solomon Islands</option> +<option value="Somalia">Somalia</option> +<option value="South Africa">South Africa</option> +<option value="South Georgia and the South Sandwich Islands">South Georgia and the South Sandwich Islands</option> +<option value="Spain">Spain</option> +<option value="Sri Lanka">Sri Lanka</option> +<option value="Sudan">Sudan</option> +<option value="Suriname">Suriname</option> +<option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option> +<option value="Swaziland">Swaziland</option> +<option value="Sweden">Sweden</option> +<option value="Switzerland">Switzerland</option> +<option value="Syrian Arab Republic">Syrian Arab Republic</option> +<option value="Taiwan, Province of China">Taiwan, Province of China</option> +<option value="Tajikistan">Tajikistan</option> +<option value="Tanzania, United Republic of">Tanzania, United Republic of</option> +<option value="Thailand">Thailand</option> +<option value="Timor-Leste">Timor-Leste</option> +<option value="Togo">Togo</option> +<option value="Tokelau">Tokelau</option> +<option value="Tonga">Tonga</option> +<option value="Trinidad and Tobago">Trinidad and Tobago</option> +<option value="Tunisia">Tunisia</option> +<option value="Turkey">Turkey</option> +<option value="Turkmenistan">Turkmenistan</option> +<option value="Turks and Caicos Islands">Turks and Caicos Islands</option> +<option value="Tuvalu">Tuvalu</option> +<option value="Uganda">Uganda</option> +<option value="Ukraine">Ukraine</option> +<option value="United Arab Emirates">United Arab Emirates</option> +<option value="United Kingdom">United Kingdom</option> +<option value="United States">United States</option> +<option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option> +<option value="Uruguay">Uruguay</option> +<option value="Uzbekistan">Uzbekistan</option> +<option value="Vanuatu">Vanuatu</option> +<option value="Venezuela">Venezuela</option> +<option value="Viet Nam">Viet Nam</option> +<option value="Virgin Islands, British">Virgin Islands, British</option> +<option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option> +<option value="Wallis and Futuna">Wallis and Futuna</option> +<option value="Western Sahara">Western Sahara</option> +<option value="Yemen">Yemen</option> +<option value="Zambia">Zambia</option> +<option value="Zimbabwe">Zimbabwe</option></select> +COUNTRIES + + fields_for :post, @post do |f| + concat f.country_select("origin") + end + + assert_dom_equal(expected_select[0..-2], output_buffer) + end + + def test_country_select_under_fields_for_with_index + @post = Post.new + @post.origin = "United States" + expected_select = <<-COUNTRIES +<select id="post_325_origin" name="post[325][origin]"><option value="Afghanistan">Afghanistan</option> +<option value="Aland Islands">Aland Islands</option> +<option value="Albania">Albania</option> +<option value="Algeria">Algeria</option> +<option value="American Samoa">American Samoa</option> +<option value="Andorra">Andorra</option> +<option value="Angola">Angola</option> +<option value="Anguilla">Anguilla</option> +<option value="Antarctica">Antarctica</option> +<option value="Antigua And Barbuda">Antigua And Barbuda</option> +<option value="Argentina">Argentina</option> +<option value="Armenia">Armenia</option> +<option value="Aruba">Aruba</option> +<option value="Australia">Australia</option> +<option value="Austria">Austria</option> +<option value="Azerbaijan">Azerbaijan</option> +<option value="Bahamas">Bahamas</option> +<option value="Bahrain">Bahrain</option> +<option value="Bangladesh">Bangladesh</option> +<option value="Barbados">Barbados</option> +<option value="Belarus">Belarus</option> +<option value="Belgium">Belgium</option> +<option value="Belize">Belize</option> +<option value="Benin">Benin</option> +<option value="Bermuda">Bermuda</option> +<option value="Bhutan">Bhutan</option> +<option value="Bolivia">Bolivia</option> +<option value="Bosnia and Herzegowina">Bosnia and Herzegowina</option> +<option value="Botswana">Botswana</option> +<option value="Bouvet Island">Bouvet Island</option> +<option value="Brazil">Brazil</option> +<option value="British Indian Ocean Territory">British Indian Ocean Territory</option> +<option value="Brunei Darussalam">Brunei Darussalam</option> +<option value="Bulgaria">Bulgaria</option> +<option value="Burkina Faso">Burkina Faso</option> +<option value="Burundi">Burundi</option> +<option value="Cambodia">Cambodia</option> +<option value="Cameroon">Cameroon</option> +<option value="Canada">Canada</option> +<option value="Cape Verde">Cape Verde</option> +<option value="Cayman Islands">Cayman Islands</option> +<option value="Central African Republic">Central African Republic</option> +<option value="Chad">Chad</option> +<option value="Chile">Chile</option> +<option value="China">China</option> +<option value="Christmas Island">Christmas Island</option> +<option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option> +<option value="Colombia">Colombia</option> +<option value="Comoros">Comoros</option> +<option value="Congo">Congo</option> +<option value="Congo, the Democratic Republic of the">Congo, the Democratic Republic of the</option> +<option value="Cook Islands">Cook Islands</option> +<option value="Costa Rica">Costa Rica</option> +<option value="Cote d'Ivoire">Cote d'Ivoire</option> +<option value="Croatia">Croatia</option> +<option value="Cuba">Cuba</option> +<option value="Cyprus">Cyprus</option> +<option value="Czech Republic">Czech Republic</option> +<option value="Denmark">Denmark</option> +<option value="Djibouti">Djibouti</option> +<option value="Dominica">Dominica</option> +<option value="Dominican Republic">Dominican Republic</option> +<option value="Ecuador">Ecuador</option> +<option value="Egypt">Egypt</option> +<option value="El Salvador">El Salvador</option> +<option value="Equatorial Guinea">Equatorial Guinea</option> +<option value="Eritrea">Eritrea</option> +<option value="Estonia">Estonia</option> +<option value="Ethiopia">Ethiopia</option> +<option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option> +<option value="Faroe Islands">Faroe Islands</option> +<option value="Fiji">Fiji</option> +<option value="Finland">Finland</option> +<option value="France">France</option> +<option value="French Guiana">French Guiana</option> +<option value="French Polynesia">French Polynesia</option> +<option value="French Southern Territories">French Southern Territories</option> +<option value="Gabon">Gabon</option> +<option value="Gambia">Gambia</option> +<option value="Georgia">Georgia</option> +<option value="Germany">Germany</option> +<option value="Ghana">Ghana</option> +<option value="Gibraltar">Gibraltar</option> +<option value="Greece">Greece</option> +<option value="Greenland">Greenland</option> +<option value="Grenada">Grenada</option> +<option value="Guadeloupe">Guadeloupe</option> +<option value="Guam">Guam</option> +<option value="Guatemala">Guatemala</option> +<option value="Guernsey">Guernsey</option> +<option value="Guinea">Guinea</option> +<option value="Guinea-Bissau">Guinea-Bissau</option> +<option value="Guyana">Guyana</option> +<option value="Haiti">Haiti</option> +<option value="Heard and McDonald Islands">Heard and McDonald Islands</option> +<option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option> +<option value="Honduras">Honduras</option> +<option value="Hong Kong">Hong Kong</option> +<option value="Hungary">Hungary</option> +<option value="Iceland">Iceland</option> +<option value="India">India</option> +<option value="Indonesia">Indonesia</option> +<option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option> +<option value="Iraq">Iraq</option> +<option value="Ireland">Ireland</option> +<option value="Isle of Man">Isle of Man</option> +<option value="Israel">Israel</option> +<option value="Italy">Italy</option> +<option value="Jamaica">Jamaica</option> +<option value="Japan">Japan</option> +<option value="Jersey">Jersey</option> +<option value="Jordan">Jordan</option> +<option value="Kazakhstan">Kazakhstan</option> +<option value="Kenya">Kenya</option> +<option value="Kiribati">Kiribati</option> +<option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option> +<option value="Korea, Republic of">Korea, Republic of</option> +<option value="Kuwait">Kuwait</option> +<option value="Kyrgyzstan">Kyrgyzstan</option> +<option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option> +<option value="Latvia">Latvia</option> +<option value="Lebanon">Lebanon</option> +<option value="Lesotho">Lesotho</option> +<option value="Liberia">Liberia</option> +<option value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</option> +<option value="Liechtenstein">Liechtenstein</option> +<option value="Lithuania">Lithuania</option> +<option value="Luxembourg">Luxembourg</option> +<option value="Macao">Macao</option> +<option value="Macedonia, The Former Yugoslav Republic Of">Macedonia, The Former Yugoslav Republic Of</option> +<option value="Madagascar">Madagascar</option> +<option value="Malawi">Malawi</option> +<option value="Malaysia">Malaysia</option> +<option value="Maldives">Maldives</option> +<option value="Mali">Mali</option> +<option value="Malta">Malta</option> +<option value="Marshall Islands">Marshall Islands</option> +<option value="Martinique">Martinique</option> +<option value="Mauritania">Mauritania</option> +<option value="Mauritius">Mauritius</option> +<option value="Mayotte">Mayotte</option> +<option value="Mexico">Mexico</option> +<option value="Micronesia, Federated States of">Micronesia, Federated States of</option> +<option value="Moldova, Republic of">Moldova, Republic of</option> +<option value="Monaco">Monaco</option> +<option value="Mongolia">Mongolia</option> +<option value="Montenegro">Montenegro</option> +<option value="Montserrat">Montserrat</option> +<option value="Morocco">Morocco</option> +<option value="Mozambique">Mozambique</option> +<option value="Myanmar">Myanmar</option> +<option value="Namibia">Namibia</option> +<option value="Nauru">Nauru</option> +<option value="Nepal">Nepal</option> +<option value="Netherlands">Netherlands</option> +<option value="Netherlands Antilles">Netherlands Antilles</option> +<option value="New Caledonia">New Caledonia</option> +<option value="New Zealand">New Zealand</option> +<option value="Nicaragua">Nicaragua</option> +<option value="Niger">Niger</option> +<option value="Nigeria">Nigeria</option> +<option value="Niue">Niue</option> +<option value="Norfolk Island">Norfolk Island</option> +<option value="Northern Mariana Islands">Northern Mariana Islands</option> +<option value="Norway">Norway</option> +<option value="Oman">Oman</option> +<option value="Pakistan">Pakistan</option> +<option value="Palau">Palau</option> +<option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option> +<option value="Panama">Panama</option> +<option value="Papua New Guinea">Papua New Guinea</option> +<option value="Paraguay">Paraguay</option> +<option value="Peru">Peru</option> +<option value="Philippines">Philippines</option> +<option value="Pitcairn">Pitcairn</option> +<option value="Poland">Poland</option> +<option value="Portugal">Portugal</option> +<option value="Puerto Rico">Puerto Rico</option> +<option value="Qatar">Qatar</option> +<option value="Reunion">Reunion</option> +<option value="Romania">Romania</option> +<option value="Russian Federation">Russian Federation</option> +<option value="Rwanda">Rwanda</option> +<option value="Saint Barthelemy">Saint Barthelemy</option> +<option value="Saint Helena">Saint Helena</option> +<option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option> +<option value="Saint Lucia">Saint Lucia</option> +<option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option> +<option value="Saint Vincent and the Grenadines">Saint Vincent and the Grenadines</option> +<option value="Samoa">Samoa</option> +<option value="San Marino">San Marino</option> +<option value="Sao Tome and Principe">Sao Tome and Principe</option> +<option value="Saudi Arabia">Saudi Arabia</option> +<option value="Senegal">Senegal</option> +<option value="Serbia">Serbia</option> +<option value="Seychelles">Seychelles</option> +<option value="Sierra Leone">Sierra Leone</option> +<option value="Singapore">Singapore</option> +<option value="Slovakia">Slovakia</option> +<option value="Slovenia">Slovenia</option> +<option value="Solomon Islands">Solomon Islands</option> +<option value="Somalia">Somalia</option> +<option value="South Africa">South Africa</option> +<option value="South Georgia and the South Sandwich Islands">South Georgia and the South Sandwich Islands</option> +<option value="Spain">Spain</option> +<option value="Sri Lanka">Sri Lanka</option> +<option value="Sudan">Sudan</option> +<option value="Suriname">Suriname</option> +<option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option> +<option value="Swaziland">Swaziland</option> +<option value="Sweden">Sweden</option> +<option value="Switzerland">Switzerland</option> +<option value="Syrian Arab Republic">Syrian Arab Republic</option> +<option value="Taiwan, Province of China">Taiwan, Province of China</option> +<option value="Tajikistan">Tajikistan</option> +<option value="Tanzania, United Republic of">Tanzania, United Republic of</option> +<option value="Thailand">Thailand</option> +<option value="Timor-Leste">Timor-Leste</option> +<option value="Togo">Togo</option> +<option value="Tokelau">Tokelau</option> +<option value="Tonga">Tonga</option> +<option value="Trinidad and Tobago">Trinidad and Tobago</option> +<option value="Tunisia">Tunisia</option> +<option value="Turkey">Turkey</option> +<option value="Turkmenistan">Turkmenistan</option> +<option value="Turks and Caicos Islands">Turks and Caicos Islands</option> +<option value="Tuvalu">Tuvalu</option> +<option value="Uganda">Uganda</option> +<option value="Ukraine">Ukraine</option> +<option value="United Arab Emirates">United Arab Emirates</option> +<option value="United Kingdom">United Kingdom</option> +<option selected="selected" value="United States">United States</option> +<option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option> +<option value="Uruguay">Uruguay</option> +<option value="Uzbekistan">Uzbekistan</option> +<option value="Vanuatu">Vanuatu</option> +<option value="Venezuela">Venezuela</option> +<option value="Viet Nam">Viet Nam</option> +<option value="Virgin Islands, British">Virgin Islands, British</option> +<option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option> +<option value="Wallis and Futuna">Wallis and Futuna</option> +<option value="Western Sahara">Western Sahara</option> +<option value="Yemen">Yemen</option> +<option value="Zambia">Zambia</option> +<option value="Zimbabwe">Zimbabwe</option></select> +COUNTRIES + + fields_for :post, @post, :index => 325 do |f| + concat f.country_select("origin") + end + + assert_dom_equal(expected_select[0..-2], output_buffer) + end + + def test_country_select_under_fields_for_with_auto_index + @post = Post.new + @post.origin = "Iraq" + def @post.to_param; 325; end + + expected_select = <<-COUNTRIES +<select id="post_325_origin" name="post[325][origin]"><option value="Afghanistan">Afghanistan</option> +<option value="Aland Islands">Aland Islands</option> +<option value="Albania">Albania</option> +<option value="Algeria">Algeria</option> +<option value="American Samoa">American Samoa</option> +<option value="Andorra">Andorra</option> +<option value="Angola">Angola</option> +<option value="Anguilla">Anguilla</option> +<option value="Antarctica">Antarctica</option> +<option value="Antigua And Barbuda">Antigua And Barbuda</option> +<option value="Argentina">Argentina</option> +<option value="Armenia">Armenia</option> +<option value="Aruba">Aruba</option> +<option value="Australia">Australia</option> +<option value="Austria">Austria</option> +<option value="Azerbaijan">Azerbaijan</option> +<option value="Bahamas">Bahamas</option> +<option value="Bahrain">Bahrain</option> +<option value="Bangladesh">Bangladesh</option> +<option value="Barbados">Barbados</option> +<option value="Belarus">Belarus</option> +<option value="Belgium">Belgium</option> +<option value="Belize">Belize</option> +<option value="Benin">Benin</option> +<option value="Bermuda">Bermuda</option> +<option value="Bhutan">Bhutan</option> +<option value="Bolivia">Bolivia</option> +<option value="Bosnia and Herzegowina">Bosnia and Herzegowina</option> +<option value="Botswana">Botswana</option> +<option value="Bouvet Island">Bouvet Island</option> +<option value="Brazil">Brazil</option> +<option value="British Indian Ocean Territory">British Indian Ocean Territory</option> +<option value="Brunei Darussalam">Brunei Darussalam</option> +<option value="Bulgaria">Bulgaria</option> +<option value="Burkina Faso">Burkina Faso</option> +<option value="Burundi">Burundi</option> +<option value="Cambodia">Cambodia</option> +<option value="Cameroon">Cameroon</option> +<option value="Canada">Canada</option> +<option value="Cape Verde">Cape Verde</option> +<option value="Cayman Islands">Cayman Islands</option> +<option value="Central African Republic">Central African Republic</option> +<option value="Chad">Chad</option> +<option value="Chile">Chile</option> +<option value="China">China</option> +<option value="Christmas Island">Christmas Island</option> +<option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option> +<option value="Colombia">Colombia</option> +<option value="Comoros">Comoros</option> +<option value="Congo">Congo</option> +<option value="Congo, the Democratic Republic of the">Congo, the Democratic Republic of the</option> +<option value="Cook Islands">Cook Islands</option> +<option value="Costa Rica">Costa Rica</option> +<option value="Cote d'Ivoire">Cote d'Ivoire</option> +<option value="Croatia">Croatia</option> +<option value="Cuba">Cuba</option> +<option value="Cyprus">Cyprus</option> +<option value="Czech Republic">Czech Republic</option> +<option value="Denmark">Denmark</option> +<option value="Djibouti">Djibouti</option> +<option value="Dominica">Dominica</option> +<option value="Dominican Republic">Dominican Republic</option> +<option value="Ecuador">Ecuador</option> +<option value="Egypt">Egypt</option> +<option value="El Salvador">El Salvador</option> +<option value="Equatorial Guinea">Equatorial Guinea</option> +<option value="Eritrea">Eritrea</option> +<option value="Estonia">Estonia</option> +<option value="Ethiopia">Ethiopia</option> +<option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option> +<option value="Faroe Islands">Faroe Islands</option> +<option value="Fiji">Fiji</option> +<option value="Finland">Finland</option> +<option value="France">France</option> +<option value="French Guiana">French Guiana</option> +<option value="French Polynesia">French Polynesia</option> +<option value="French Southern Territories">French Southern Territories</option> +<option value="Gabon">Gabon</option> +<option value="Gambia">Gambia</option> +<option value="Georgia">Georgia</option> +<option value="Germany">Germany</option> +<option value="Ghana">Ghana</option> +<option value="Gibraltar">Gibraltar</option> +<option value="Greece">Greece</option> +<option value="Greenland">Greenland</option> +<option value="Grenada">Grenada</option> +<option value="Guadeloupe">Guadeloupe</option> +<option value="Guam">Guam</option> +<option value="Guatemala">Guatemala</option> +<option value="Guernsey">Guernsey</option> +<option value="Guinea">Guinea</option> +<option value="Guinea-Bissau">Guinea-Bissau</option> +<option value="Guyana">Guyana</option> +<option value="Haiti">Haiti</option> +<option value="Heard and McDonald Islands">Heard and McDonald Islands</option> +<option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option> +<option value="Honduras">Honduras</option> +<option value="Hong Kong">Hong Kong</option> +<option value="Hungary">Hungary</option> +<option value="Iceland">Iceland</option> +<option value="India">India</option> +<option value="Indonesia">Indonesia</option> +<option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option> +<option selected="selected" value="Iraq">Iraq</option> +<option value="Ireland">Ireland</option> +<option value="Isle of Man">Isle of Man</option> +<option value="Israel">Israel</option> +<option value="Italy">Italy</option> +<option value="Jamaica">Jamaica</option> +<option value="Japan">Japan</option> +<option value="Jersey">Jersey</option> +<option value="Jordan">Jordan</option> +<option value="Kazakhstan">Kazakhstan</option> +<option value="Kenya">Kenya</option> +<option value="Kiribati">Kiribati</option> +<option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option> +<option value="Korea, Republic of">Korea, Republic of</option> +<option value="Kuwait">Kuwait</option> +<option value="Kyrgyzstan">Kyrgyzstan</option> +<option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option> +<option value="Latvia">Latvia</option> +<option value="Lebanon">Lebanon</option> +<option value="Lesotho">Lesotho</option> +<option value="Liberia">Liberia</option> +<option value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</option> +<option value="Liechtenstein">Liechtenstein</option> +<option value="Lithuania">Lithuania</option> +<option value="Luxembourg">Luxembourg</option> +<option value="Macao">Macao</option> +<option value="Macedonia, The Former Yugoslav Republic Of">Macedonia, The Former Yugoslav Republic Of</option> +<option value="Madagascar">Madagascar</option> +<option value="Malawi">Malawi</option> +<option value="Malaysia">Malaysia</option> +<option value="Maldives">Maldives</option> +<option value="Mali">Mali</option> +<option value="Malta">Malta</option> +<option value="Marshall Islands">Marshall Islands</option> +<option value="Martinique">Martinique</option> +<option value="Mauritania">Mauritania</option> +<option value="Mauritius">Mauritius</option> +<option value="Mayotte">Mayotte</option> +<option value="Mexico">Mexico</option> +<option value="Micronesia, Federated States of">Micronesia, Federated States of</option> +<option value="Moldova, Republic of">Moldova, Republic of</option> +<option value="Monaco">Monaco</option> +<option value="Mongolia">Mongolia</option> +<option value="Montenegro">Montenegro</option> +<option value="Montserrat">Montserrat</option> +<option value="Morocco">Morocco</option> +<option value="Mozambique">Mozambique</option> +<option value="Myanmar">Myanmar</option> +<option value="Namibia">Namibia</option> +<option value="Nauru">Nauru</option> +<option value="Nepal">Nepal</option> +<option value="Netherlands">Netherlands</option> +<option value="Netherlands Antilles">Netherlands Antilles</option> +<option value="New Caledonia">New Caledonia</option> +<option value="New Zealand">New Zealand</option> +<option value="Nicaragua">Nicaragua</option> +<option value="Niger">Niger</option> +<option value="Nigeria">Nigeria</option> +<option value="Niue">Niue</option> +<option value="Norfolk Island">Norfolk Island</option> +<option value="Northern Mariana Islands">Northern Mariana Islands</option> +<option value="Norway">Norway</option> +<option value="Oman">Oman</option> +<option value="Pakistan">Pakistan</option> +<option value="Palau">Palau</option> +<option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option> +<option value="Panama">Panama</option> +<option value="Papua New Guinea">Papua New Guinea</option> +<option value="Paraguay">Paraguay</option> +<option value="Peru">Peru</option> +<option value="Philippines">Philippines</option> +<option value="Pitcairn">Pitcairn</option> +<option value="Poland">Poland</option> +<option value="Portugal">Portugal</option> +<option value="Puerto Rico">Puerto Rico</option> +<option value="Qatar">Qatar</option> +<option value="Reunion">Reunion</option> +<option value="Romania">Romania</option> +<option value="Russian Federation">Russian Federation</option> +<option value="Rwanda">Rwanda</option> +<option value="Saint Barthelemy">Saint Barthelemy</option> +<option value="Saint Helena">Saint Helena</option> +<option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option> +<option value="Saint Lucia">Saint Lucia</option> +<option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option> +<option value="Saint Vincent and the Grenadines">Saint Vincent and the Grenadines</option> +<option value="Samoa">Samoa</option> +<option value="San Marino">San Marino</option> +<option value="Sao Tome and Principe">Sao Tome and Principe</option> +<option value="Saudi Arabia">Saudi Arabia</option> +<option value="Senegal">Senegal</option> +<option value="Serbia">Serbia</option> +<option value="Seychelles">Seychelles</option> +<option value="Sierra Leone">Sierra Leone</option> +<option value="Singapore">Singapore</option> +<option value="Slovakia">Slovakia</option> +<option value="Slovenia">Slovenia</option> +<option value="Solomon Islands">Solomon Islands</option> +<option value="Somalia">Somalia</option> +<option value="South Africa">South Africa</option> +<option value="South Georgia and the South Sandwich Islands">South Georgia and the South Sandwich Islands</option> +<option value="Spain">Spain</option> +<option value="Sri Lanka">Sri Lanka</option> +<option value="Sudan">Sudan</option> +<option value="Suriname">Suriname</option> +<option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option> +<option value="Swaziland">Swaziland</option> +<option value="Sweden">Sweden</option> +<option value="Switzerland">Switzerland</option> +<option value="Syrian Arab Republic">Syrian Arab Republic</option> +<option value="Taiwan, Province of China">Taiwan, Province of China</option> +<option value="Tajikistan">Tajikistan</option> +<option value="Tanzania, United Republic of">Tanzania, United Republic of</option> +<option value="Thailand">Thailand</option> +<option value="Timor-Leste">Timor-Leste</option> +<option value="Togo">Togo</option> +<option value="Tokelau">Tokelau</option> +<option value="Tonga">Tonga</option> +<option value="Trinidad and Tobago">Trinidad and Tobago</option> +<option value="Tunisia">Tunisia</option> +<option value="Turkey">Turkey</option> +<option value="Turkmenistan">Turkmenistan</option> +<option value="Turks and Caicos Islands">Turks and Caicos Islands</option> +<option value="Tuvalu">Tuvalu</option> +<option value="Uganda">Uganda</option> +<option value="Ukraine">Ukraine</option> +<option value="United Arab Emirates">United Arab Emirates</option> +<option value="United Kingdom">United Kingdom</option> +<option value="United States">United States</option> +<option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option> +<option value="Uruguay">Uruguay</option> +<option value="Uzbekistan">Uzbekistan</option> +<option value="Vanuatu">Vanuatu</option> +<option value="Venezuela">Venezuela</option> +<option value="Viet Nam">Viet Nam</option> +<option value="Virgin Islands, British">Virgin Islands, British</option> +<option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option> +<option value="Wallis and Futuna">Wallis and Futuna</option> +<option value="Western Sahara">Western Sahara</option> +<option value="Yemen">Yemen</option> +<option value="Zambia">Zambia</option> +<option value="Zimbabwe">Zimbabwe</option></select> +COUNTRIES + + fields_for "post[]", @post do |f| + concat f.country_select("origin") + end + + assert_dom_equal(expected_select[0..-2], output_buffer) + end + end
\ No newline at end of file diff --git a/actionpack/test/template/form_options_helper_test.rb b/actionpack/test/template/form_options_helper_test.rb index 9dd43d7b4f..a33eb85b66 100644 --- a/actionpack/test/template/form_options_helper_test.rb +++ b/actionpack/test/template/form_options_helper_test.rb @@ -472,1545 +472,6 @@ uses_mocha "FormOptionsHelperTest" do assert_dom_equal expected, collection_select("post", "author_name", @posts, "author_name", "author_name", { :include_blank => true, :name => 'post[author_name][]' }, :multiple => true) end - def test_country_select - @post = Post.new - @post.origin = "Denmark" - expected_select = <<-COUNTRIES -<select id="post_origin" name="post[origin]"><option value="Afghanistan">Afghanistan</option> -<option value="Aland Islands">Aland Islands</option> -<option value="Albania">Albania</option> -<option value="Algeria">Algeria</option> -<option value="American Samoa">American Samoa</option> -<option value="Andorra">Andorra</option> -<option value="Angola">Angola</option> -<option value="Anguilla">Anguilla</option> -<option value="Antarctica">Antarctica</option> -<option value="Antigua And Barbuda">Antigua And Barbuda</option> -<option value="Argentina">Argentina</option> -<option value="Armenia">Armenia</option> -<option value="Aruba">Aruba</option> -<option value="Australia">Australia</option> -<option value="Austria">Austria</option> -<option value="Azerbaijan">Azerbaijan</option> -<option value="Bahamas">Bahamas</option> -<option value="Bahrain">Bahrain</option> -<option value="Bangladesh">Bangladesh</option> -<option value="Barbados">Barbados</option> -<option value="Belarus">Belarus</option> -<option value="Belgium">Belgium</option> -<option value="Belize">Belize</option> -<option value="Benin">Benin</option> -<option value="Bermuda">Bermuda</option> -<option value="Bhutan">Bhutan</option> -<option value="Bolivia">Bolivia</option> -<option value="Bosnia and Herzegowina">Bosnia and Herzegowina</option> -<option value="Botswana">Botswana</option> -<option value="Bouvet Island">Bouvet Island</option> -<option value="Brazil">Brazil</option> -<option value="British Indian Ocean Territory">British Indian Ocean Territory</option> -<option value="Brunei Darussalam">Brunei Darussalam</option> -<option value="Bulgaria">Bulgaria</option> -<option value="Burkina Faso">Burkina Faso</option> -<option value="Burundi">Burundi</option> -<option value="Cambodia">Cambodia</option> -<option value="Cameroon">Cameroon</option> -<option value="Canada">Canada</option> -<option value="Cape Verde">Cape Verde</option> -<option value="Cayman Islands">Cayman Islands</option> -<option value="Central African Republic">Central African Republic</option> -<option value="Chad">Chad</option> -<option value="Chile">Chile</option> -<option value="China">China</option> -<option value="Christmas Island">Christmas Island</option> -<option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option> -<option value="Colombia">Colombia</option> -<option value="Comoros">Comoros</option> -<option value="Congo">Congo</option> -<option value="Congo, the Democratic Republic of the">Congo, the Democratic Republic of the</option> -<option value="Cook Islands">Cook Islands</option> -<option value="Costa Rica">Costa Rica</option> -<option value="Cote d'Ivoire">Cote d'Ivoire</option> -<option value="Croatia">Croatia</option> -<option value="Cuba">Cuba</option> -<option value="Cyprus">Cyprus</option> -<option value="Czech Republic">Czech Republic</option> -<option selected="selected" value="Denmark">Denmark</option> -<option value="Djibouti">Djibouti</option> -<option value="Dominica">Dominica</option> -<option value="Dominican Republic">Dominican Republic</option> -<option value="Ecuador">Ecuador</option> -<option value="Egypt">Egypt</option> -<option value="El Salvador">El Salvador</option> -<option value="Equatorial Guinea">Equatorial Guinea</option> -<option value="Eritrea">Eritrea</option> -<option value="Estonia">Estonia</option> -<option value="Ethiopia">Ethiopia</option> -<option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option> -<option value="Faroe Islands">Faroe Islands</option> -<option value="Fiji">Fiji</option> -<option value="Finland">Finland</option> -<option value="France">France</option> -<option value="French Guiana">French Guiana</option> -<option value="French Polynesia">French Polynesia</option> -<option value="French Southern Territories">French Southern Territories</option> -<option value="Gabon">Gabon</option> -<option value="Gambia">Gambia</option> -<option value="Georgia">Georgia</option> -<option value="Germany">Germany</option> -<option value="Ghana">Ghana</option> -<option value="Gibraltar">Gibraltar</option> -<option value="Greece">Greece</option> -<option value="Greenland">Greenland</option> -<option value="Grenada">Grenada</option> -<option value="Guadeloupe">Guadeloupe</option> -<option value="Guam">Guam</option> -<option value="Guatemala">Guatemala</option> -<option value="Guernsey">Guernsey</option> -<option value="Guinea">Guinea</option> -<option value="Guinea-Bissau">Guinea-Bissau</option> -<option value="Guyana">Guyana</option> -<option value="Haiti">Haiti</option> -<option value="Heard and McDonald Islands">Heard and McDonald Islands</option> -<option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option> -<option value="Honduras">Honduras</option> -<option value="Hong Kong">Hong Kong</option> -<option value="Hungary">Hungary</option> -<option value="Iceland">Iceland</option> -<option value="India">India</option> -<option value="Indonesia">Indonesia</option> -<option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option> -<option value="Iraq">Iraq</option> -<option value="Ireland">Ireland</option> -<option value="Isle of Man">Isle of Man</option> -<option value="Israel">Israel</option> -<option value="Italy">Italy</option> -<option value="Jamaica">Jamaica</option> -<option value="Japan">Japan</option> -<option value="Jersey">Jersey</option> -<option value="Jordan">Jordan</option> -<option value="Kazakhstan">Kazakhstan</option> -<option value="Kenya">Kenya</option> -<option value="Kiribati">Kiribati</option> -<option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option> -<option value="Korea, Republic of">Korea, Republic of</option> -<option value="Kuwait">Kuwait</option> -<option value="Kyrgyzstan">Kyrgyzstan</option> -<option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option> -<option value="Latvia">Latvia</option> -<option value="Lebanon">Lebanon</option> -<option value="Lesotho">Lesotho</option> -<option value="Liberia">Liberia</option> -<option value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</option> -<option value="Liechtenstein">Liechtenstein</option> -<option value="Lithuania">Lithuania</option> -<option value="Luxembourg">Luxembourg</option> -<option value="Macao">Macao</option> -<option value="Macedonia, The Former Yugoslav Republic Of">Macedonia, The Former Yugoslav Republic Of</option> -<option value="Madagascar">Madagascar</option> -<option value="Malawi">Malawi</option> -<option value="Malaysia">Malaysia</option> -<option value="Maldives">Maldives</option> -<option value="Mali">Mali</option> -<option value="Malta">Malta</option> -<option value="Marshall Islands">Marshall Islands</option> -<option value="Martinique">Martinique</option> -<option value="Mauritania">Mauritania</option> -<option value="Mauritius">Mauritius</option> -<option value="Mayotte">Mayotte</option> -<option value="Mexico">Mexico</option> -<option value="Micronesia, Federated States of">Micronesia, Federated States of</option> -<option value="Moldova, Republic of">Moldova, Republic of</option> -<option value="Monaco">Monaco</option> -<option value="Mongolia">Mongolia</option> -<option value="Montenegro">Montenegro</option> -<option value="Montserrat">Montserrat</option> -<option value="Morocco">Morocco</option> -<option value="Mozambique">Mozambique</option> -<option value="Myanmar">Myanmar</option> -<option value="Namibia">Namibia</option> -<option value="Nauru">Nauru</option> -<option value="Nepal">Nepal</option> -<option value="Netherlands">Netherlands</option> -<option value="Netherlands Antilles">Netherlands Antilles</option> -<option value="New Caledonia">New Caledonia</option> -<option value="New Zealand">New Zealand</option> -<option value="Nicaragua">Nicaragua</option> -<option value="Niger">Niger</option> -<option value="Nigeria">Nigeria</option> -<option value="Niue">Niue</option> -<option value="Norfolk Island">Norfolk Island</option> -<option value="Northern Mariana Islands">Northern Mariana Islands</option> -<option value="Norway">Norway</option> -<option value="Oman">Oman</option> -<option value="Pakistan">Pakistan</option> -<option value="Palau">Palau</option> -<option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option> -<option value="Panama">Panama</option> -<option value="Papua New Guinea">Papua New Guinea</option> -<option value="Paraguay">Paraguay</option> -<option value="Peru">Peru</option> -<option value="Philippines">Philippines</option> -<option value="Pitcairn">Pitcairn</option> -<option value="Poland">Poland</option> -<option value="Portugal">Portugal</option> -<option value="Puerto Rico">Puerto Rico</option> -<option value="Qatar">Qatar</option> -<option value="Reunion">Reunion</option> -<option value="Romania">Romania</option> -<option value="Russian Federation">Russian Federation</option> -<option value="Rwanda">Rwanda</option> -<option value="Saint Barthelemy">Saint Barthelemy</option> -<option value="Saint Helena">Saint Helena</option> -<option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option> -<option value="Saint Lucia">Saint Lucia</option> -<option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option> -<option value="Saint Vincent and the Grenadines">Saint Vincent and the Grenadines</option> -<option value="Samoa">Samoa</option> -<option value="San Marino">San Marino</option> -<option value="Sao Tome and Principe">Sao Tome and Principe</option> -<option value="Saudi Arabia">Saudi Arabia</option> -<option value="Senegal">Senegal</option> -<option value="Serbia">Serbia</option> -<option value="Seychelles">Seychelles</option> -<option value="Sierra Leone">Sierra Leone</option> -<option value="Singapore">Singapore</option> -<option value="Slovakia">Slovakia</option> -<option value="Slovenia">Slovenia</option> -<option value="Solomon Islands">Solomon Islands</option> -<option value="Somalia">Somalia</option> -<option value="South Africa">South Africa</option> -<option value="South Georgia and the South Sandwich Islands">South Georgia and the South Sandwich Islands</option> -<option value="Spain">Spain</option> -<option value="Sri Lanka">Sri Lanka</option> -<option value="Sudan">Sudan</option> -<option value="Suriname">Suriname</option> -<option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option> -<option value="Swaziland">Swaziland</option> -<option value="Sweden">Sweden</option> -<option value="Switzerland">Switzerland</option> -<option value="Syrian Arab Republic">Syrian Arab Republic</option> -<option value="Taiwan, Province of China">Taiwan, Province of China</option> -<option value="Tajikistan">Tajikistan</option> -<option value="Tanzania, United Republic of">Tanzania, United Republic of</option> -<option value="Thailand">Thailand</option> -<option value="Timor-Leste">Timor-Leste</option> -<option value="Togo">Togo</option> -<option value="Tokelau">Tokelau</option> -<option value="Tonga">Tonga</option> -<option value="Trinidad and Tobago">Trinidad and Tobago</option> -<option value="Tunisia">Tunisia</option> -<option value="Turkey">Turkey</option> -<option value="Turkmenistan">Turkmenistan</option> -<option value="Turks and Caicos Islands">Turks and Caicos Islands</option> -<option value="Tuvalu">Tuvalu</option> -<option value="Uganda">Uganda</option> -<option value="Ukraine">Ukraine</option> -<option value="United Arab Emirates">United Arab Emirates</option> -<option value="United Kingdom">United Kingdom</option> -<option value="United States">United States</option> -<option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option> -<option value="Uruguay">Uruguay</option> -<option value="Uzbekistan">Uzbekistan</option> -<option value="Vanuatu">Vanuatu</option> -<option value="Venezuela">Venezuela</option> -<option value="Viet Nam">Viet Nam</option> -<option value="Virgin Islands, British">Virgin Islands, British</option> -<option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option> -<option value="Wallis and Futuna">Wallis and Futuna</option> -<option value="Western Sahara">Western Sahara</option> -<option value="Yemen">Yemen</option> -<option value="Zambia">Zambia</option> -<option value="Zimbabwe">Zimbabwe</option></select> - COUNTRIES - assert_dom_equal(expected_select[0..-2], country_select("post", "origin")) - end - - def test_country_select_with_priority_countries - @post = Post.new - @post.origin = "Denmark" - expected_select = <<-COUNTRIES -<select id="post_origin" name="post[origin]"><option value="New Zealand">New Zealand</option> -<option value="Nicaragua">Nicaragua</option><option value="" disabled="disabled">-------------</option> -<option value="Afghanistan">Afghanistan</option> -<option value="Aland Islands">Aland Islands</option> -<option value="Albania">Albania</option> -<option value="Algeria">Algeria</option> -<option value="American Samoa">American Samoa</option> -<option value="Andorra">Andorra</option> -<option value="Angola">Angola</option> -<option value="Anguilla">Anguilla</option> -<option value="Antarctica">Antarctica</option> -<option value="Antigua And Barbuda">Antigua And Barbuda</option> -<option value="Argentina">Argentina</option> -<option value="Armenia">Armenia</option> -<option value="Aruba">Aruba</option> -<option value="Australia">Australia</option> -<option value="Austria">Austria</option> -<option value="Azerbaijan">Azerbaijan</option> -<option value="Bahamas">Bahamas</option> -<option value="Bahrain">Bahrain</option> -<option value="Bangladesh">Bangladesh</option> -<option value="Barbados">Barbados</option> -<option value="Belarus">Belarus</option> -<option value="Belgium">Belgium</option> -<option value="Belize">Belize</option> -<option value="Benin">Benin</option> -<option value="Bermuda">Bermuda</option> -<option value="Bhutan">Bhutan</option> -<option value="Bolivia">Bolivia</option> -<option value="Bosnia and Herzegowina">Bosnia and Herzegowina</option> -<option value="Botswana">Botswana</option> -<option value="Bouvet Island">Bouvet Island</option> -<option value="Brazil">Brazil</option> -<option value="British Indian Ocean Territory">British Indian Ocean Territory</option> -<option value="Brunei Darussalam">Brunei Darussalam</option> -<option value="Bulgaria">Bulgaria</option> -<option value="Burkina Faso">Burkina Faso</option> -<option value="Burundi">Burundi</option> -<option value="Cambodia">Cambodia</option> -<option value="Cameroon">Cameroon</option> -<option value="Canada">Canada</option> -<option value="Cape Verde">Cape Verde</option> -<option value="Cayman Islands">Cayman Islands</option> -<option value="Central African Republic">Central African Republic</option> -<option value="Chad">Chad</option> -<option value="Chile">Chile</option> -<option value="China">China</option> -<option value="Christmas Island">Christmas Island</option> -<option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option> -<option value="Colombia">Colombia</option> -<option value="Comoros">Comoros</option> -<option value="Congo">Congo</option> -<option value="Congo, the Democratic Republic of the">Congo, the Democratic Republic of the</option> -<option value="Cook Islands">Cook Islands</option> -<option value="Costa Rica">Costa Rica</option> -<option value="Cote d'Ivoire">Cote d'Ivoire</option> -<option value="Croatia">Croatia</option> -<option value="Cuba">Cuba</option> -<option value="Cyprus">Cyprus</option> -<option value="Czech Republic">Czech Republic</option> -<option selected="selected" value="Denmark">Denmark</option> -<option value="Djibouti">Djibouti</option> -<option value="Dominica">Dominica</option> -<option value="Dominican Republic">Dominican Republic</option> -<option value="Ecuador">Ecuador</option> -<option value="Egypt">Egypt</option> -<option value="El Salvador">El Salvador</option> -<option value="Equatorial Guinea">Equatorial Guinea</option> -<option value="Eritrea">Eritrea</option> -<option value="Estonia">Estonia</option> -<option value="Ethiopia">Ethiopia</option> -<option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option> -<option value="Faroe Islands">Faroe Islands</option> -<option value="Fiji">Fiji</option> -<option value="Finland">Finland</option> -<option value="France">France</option> -<option value="French Guiana">French Guiana</option> -<option value="French Polynesia">French Polynesia</option> -<option value="French Southern Territories">French Southern Territories</option> -<option value="Gabon">Gabon</option> -<option value="Gambia">Gambia</option> -<option value="Georgia">Georgia</option> -<option value="Germany">Germany</option> -<option value="Ghana">Ghana</option> -<option value="Gibraltar">Gibraltar</option> -<option value="Greece">Greece</option> -<option value="Greenland">Greenland</option> -<option value="Grenada">Grenada</option> -<option value="Guadeloupe">Guadeloupe</option> -<option value="Guam">Guam</option> -<option value="Guatemala">Guatemala</option> -<option value="Guernsey">Guernsey</option> -<option value="Guinea">Guinea</option> -<option value="Guinea-Bissau">Guinea-Bissau</option> -<option value="Guyana">Guyana</option> -<option value="Haiti">Haiti</option> -<option value="Heard and McDonald Islands">Heard and McDonald Islands</option> -<option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option> -<option value="Honduras">Honduras</option> -<option value="Hong Kong">Hong Kong</option> -<option value="Hungary">Hungary</option> -<option value="Iceland">Iceland</option> -<option value="India">India</option> -<option value="Indonesia">Indonesia</option> -<option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option> -<option value="Iraq">Iraq</option> -<option value="Ireland">Ireland</option> -<option value="Isle of Man">Isle of Man</option> -<option value="Israel">Israel</option> -<option value="Italy">Italy</option> -<option value="Jamaica">Jamaica</option> -<option value="Japan">Japan</option> -<option value="Jersey">Jersey</option> -<option value="Jordan">Jordan</option> -<option value="Kazakhstan">Kazakhstan</option> -<option value="Kenya">Kenya</option> -<option value="Kiribati">Kiribati</option> -<option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option> -<option value="Korea, Republic of">Korea, Republic of</option> -<option value="Kuwait">Kuwait</option> -<option value="Kyrgyzstan">Kyrgyzstan</option> -<option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option> -<option value="Latvia">Latvia</option> -<option value="Lebanon">Lebanon</option> -<option value="Lesotho">Lesotho</option> -<option value="Liberia">Liberia</option> -<option value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</option> -<option value="Liechtenstein">Liechtenstein</option> -<option value="Lithuania">Lithuania</option> -<option value="Luxembourg">Luxembourg</option> -<option value="Macao">Macao</option> -<option value="Macedonia, The Former Yugoslav Republic Of">Macedonia, The Former Yugoslav Republic Of</option> -<option value="Madagascar">Madagascar</option> -<option value="Malawi">Malawi</option> -<option value="Malaysia">Malaysia</option> -<option value="Maldives">Maldives</option> -<option value="Mali">Mali</option> -<option value="Malta">Malta</option> -<option value="Marshall Islands">Marshall Islands</option> -<option value="Martinique">Martinique</option> -<option value="Mauritania">Mauritania</option> -<option value="Mauritius">Mauritius</option> -<option value="Mayotte">Mayotte</option> -<option value="Mexico">Mexico</option> -<option value="Micronesia, Federated States of">Micronesia, Federated States of</option> -<option value="Moldova, Republic of">Moldova, Republic of</option> -<option value="Monaco">Monaco</option> -<option value="Mongolia">Mongolia</option> -<option value="Montenegro">Montenegro</option> -<option value="Montserrat">Montserrat</option> -<option value="Morocco">Morocco</option> -<option value="Mozambique">Mozambique</option> -<option value="Myanmar">Myanmar</option> -<option value="Namibia">Namibia</option> -<option value="Nauru">Nauru</option> -<option value="Nepal">Nepal</option> -<option value="Netherlands">Netherlands</option> -<option value="Netherlands Antilles">Netherlands Antilles</option> -<option value="New Caledonia">New Caledonia</option> -<option value="New Zealand">New Zealand</option> -<option value="Nicaragua">Nicaragua</option> -<option value="Niger">Niger</option> -<option value="Nigeria">Nigeria</option> -<option value="Niue">Niue</option> -<option value="Norfolk Island">Norfolk Island</option> -<option value="Northern Mariana Islands">Northern Mariana Islands</option> -<option value="Norway">Norway</option> -<option value="Oman">Oman</option> -<option value="Pakistan">Pakistan</option> -<option value="Palau">Palau</option> -<option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option> -<option value="Panama">Panama</option> -<option value="Papua New Guinea">Papua New Guinea</option> -<option value="Paraguay">Paraguay</option> -<option value="Peru">Peru</option> -<option value="Philippines">Philippines</option> -<option value="Pitcairn">Pitcairn</option> -<option value="Poland">Poland</option> -<option value="Portugal">Portugal</option> -<option value="Puerto Rico">Puerto Rico</option> -<option value="Qatar">Qatar</option> -<option value="Reunion">Reunion</option> -<option value="Romania">Romania</option> -<option value="Russian Federation">Russian Federation</option> -<option value="Rwanda">Rwanda</option> -<option value="Saint Barthelemy">Saint Barthelemy</option> -<option value="Saint Helena">Saint Helena</option> -<option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option> -<option value="Saint Lucia">Saint Lucia</option> -<option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option> -<option value="Saint Vincent and the Grenadines">Saint Vincent and the Grenadines</option> -<option value="Samoa">Samoa</option> -<option value="San Marino">San Marino</option> -<option value="Sao Tome and Principe">Sao Tome and Principe</option> -<option value="Saudi Arabia">Saudi Arabia</option> -<option value="Senegal">Senegal</option> -<option value="Serbia">Serbia</option> -<option value="Seychelles">Seychelles</option> -<option value="Sierra Leone">Sierra Leone</option> -<option value="Singapore">Singapore</option> -<option value="Slovakia">Slovakia</option> -<option value="Slovenia">Slovenia</option> -<option value="Solomon Islands">Solomon Islands</option> -<option value="Somalia">Somalia</option> -<option value="South Africa">South Africa</option> -<option value="South Georgia and the South Sandwich Islands">South Georgia and the South Sandwich Islands</option> -<option value="Spain">Spain</option> -<option value="Sri Lanka">Sri Lanka</option> -<option value="Sudan">Sudan</option> -<option value="Suriname">Suriname</option> -<option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option> -<option value="Swaziland">Swaziland</option> -<option value="Sweden">Sweden</option> -<option value="Switzerland">Switzerland</option> -<option value="Syrian Arab Republic">Syrian Arab Republic</option> -<option value="Taiwan, Province of China">Taiwan, Province of China</option> -<option value="Tajikistan">Tajikistan</option> -<option value="Tanzania, United Republic of">Tanzania, United Republic of</option> -<option value="Thailand">Thailand</option> -<option value="Timor-Leste">Timor-Leste</option> -<option value="Togo">Togo</option> -<option value="Tokelau">Tokelau</option> -<option value="Tonga">Tonga</option> -<option value="Trinidad and Tobago">Trinidad and Tobago</option> -<option value="Tunisia">Tunisia</option> -<option value="Turkey">Turkey</option> -<option value="Turkmenistan">Turkmenistan</option> -<option value="Turks and Caicos Islands">Turks and Caicos Islands</option> -<option value="Tuvalu">Tuvalu</option> -<option value="Uganda">Uganda</option> -<option value="Ukraine">Ukraine</option> -<option value="United Arab Emirates">United Arab Emirates</option> -<option value="United Kingdom">United Kingdom</option> -<option value="United States">United States</option> -<option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option> -<option value="Uruguay">Uruguay</option> -<option value="Uzbekistan">Uzbekistan</option> -<option value="Vanuatu">Vanuatu</option> -<option value="Venezuela">Venezuela</option> -<option value="Viet Nam">Viet Nam</option> -<option value="Virgin Islands, British">Virgin Islands, British</option> -<option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option> -<option value="Wallis and Futuna">Wallis and Futuna</option> -<option value="Western Sahara">Western Sahara</option> -<option value="Yemen">Yemen</option> -<option value="Zambia">Zambia</option> -<option value="Zimbabwe">Zimbabwe</option></select> - COUNTRIES - assert_dom_equal(expected_select[0..-2], country_select("post", "origin", ["New Zealand", "Nicaragua"])) - end - - def test_country_select_with_selected_priority_country - @post = Post.new - @post.origin = "New Zealand" - expected_select = <<-COUNTRIES -<select id="post_origin" name="post[origin]"><option selected="selected" value="New Zealand">New Zealand</option> -<option value="Nicaragua">Nicaragua</option><option value="" disabled="disabled">-------------</option> -<option value="Afghanistan">Afghanistan</option> -<option value="Aland Islands">Aland Islands</option> -<option value="Albania">Albania</option> -<option value="Algeria">Algeria</option> -<option value="American Samoa">American Samoa</option> -<option value="Andorra">Andorra</option> -<option value="Angola">Angola</option> -<option value="Anguilla">Anguilla</option> -<option value="Antarctica">Antarctica</option> -<option value="Antigua And Barbuda">Antigua And Barbuda</option> -<option value="Argentina">Argentina</option> -<option value="Armenia">Armenia</option> -<option value="Aruba">Aruba</option> -<option value="Australia">Australia</option> -<option value="Austria">Austria</option> -<option value="Azerbaijan">Azerbaijan</option> -<option value="Bahamas">Bahamas</option> -<option value="Bahrain">Bahrain</option> -<option value="Bangladesh">Bangladesh</option> -<option value="Barbados">Barbados</option> -<option value="Belarus">Belarus</option> -<option value="Belgium">Belgium</option> -<option value="Belize">Belize</option> -<option value="Benin">Benin</option> -<option value="Bermuda">Bermuda</option> -<option value="Bhutan">Bhutan</option> -<option value="Bolivia">Bolivia</option> -<option value="Bosnia and Herzegowina">Bosnia and Herzegowina</option> -<option value="Botswana">Botswana</option> -<option value="Bouvet Island">Bouvet Island</option> -<option value="Brazil">Brazil</option> -<option value="British Indian Ocean Territory">British Indian Ocean Territory</option> -<option value="Brunei Darussalam">Brunei Darussalam</option> -<option value="Bulgaria">Bulgaria</option> -<option value="Burkina Faso">Burkina Faso</option> -<option value="Burundi">Burundi</option> -<option value="Cambodia">Cambodia</option> -<option value="Cameroon">Cameroon</option> -<option value="Canada">Canada</option> -<option value="Cape Verde">Cape Verde</option> -<option value="Cayman Islands">Cayman Islands</option> -<option value="Central African Republic">Central African Republic</option> -<option value="Chad">Chad</option> -<option value="Chile">Chile</option> -<option value="China">China</option> -<option value="Christmas Island">Christmas Island</option> -<option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option> -<option value="Colombia">Colombia</option> -<option value="Comoros">Comoros</option> -<option value="Congo">Congo</option> -<option value="Congo, the Democratic Republic of the">Congo, the Democratic Republic of the</option> -<option value="Cook Islands">Cook Islands</option> -<option value="Costa Rica">Costa Rica</option> -<option value="Cote d'Ivoire">Cote d'Ivoire</option> -<option value="Croatia">Croatia</option> -<option value="Cuba">Cuba</option> -<option value="Cyprus">Cyprus</option> -<option value="Czech Republic">Czech Republic</option> -<option value="Denmark">Denmark</option> -<option value="Djibouti">Djibouti</option> -<option value="Dominica">Dominica</option> -<option value="Dominican Republic">Dominican Republic</option> -<option value="Ecuador">Ecuador</option> -<option value="Egypt">Egypt</option> -<option value="El Salvador">El Salvador</option> -<option value="Equatorial Guinea">Equatorial Guinea</option> -<option value="Eritrea">Eritrea</option> -<option value="Estonia">Estonia</option> -<option value="Ethiopia">Ethiopia</option> -<option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option> -<option value="Faroe Islands">Faroe Islands</option> -<option value="Fiji">Fiji</option> -<option value="Finland">Finland</option> -<option value="France">France</option> -<option value="French Guiana">French Guiana</option> -<option value="French Polynesia">French Polynesia</option> -<option value="French Southern Territories">French Southern Territories</option> -<option value="Gabon">Gabon</option> -<option value="Gambia">Gambia</option> -<option value="Georgia">Georgia</option> -<option value="Germany">Germany</option> -<option value="Ghana">Ghana</option> -<option value="Gibraltar">Gibraltar</option> -<option value="Greece">Greece</option> -<option value="Greenland">Greenland</option> -<option value="Grenada">Grenada</option> -<option value="Guadeloupe">Guadeloupe</option> -<option value="Guam">Guam</option> -<option value="Guatemala">Guatemala</option> -<option value="Guernsey">Guernsey</option> -<option value="Guinea">Guinea</option> -<option value="Guinea-Bissau">Guinea-Bissau</option> -<option value="Guyana">Guyana</option> -<option value="Haiti">Haiti</option> -<option value="Heard and McDonald Islands">Heard and McDonald Islands</option> -<option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option> -<option value="Honduras">Honduras</option> -<option value="Hong Kong">Hong Kong</option> -<option value="Hungary">Hungary</option> -<option value="Iceland">Iceland</option> -<option value="India">India</option> -<option value="Indonesia">Indonesia</option> -<option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option> -<option value="Iraq">Iraq</option> -<option value="Ireland">Ireland</option> -<option value="Isle of Man">Isle of Man</option> -<option value="Israel">Israel</option> -<option value="Italy">Italy</option> -<option value="Jamaica">Jamaica</option> -<option value="Japan">Japan</option> -<option value="Jersey">Jersey</option> -<option value="Jordan">Jordan</option> -<option value="Kazakhstan">Kazakhstan</option> -<option value="Kenya">Kenya</option> -<option value="Kiribati">Kiribati</option> -<option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option> -<option value="Korea, Republic of">Korea, Republic of</option> -<option value="Kuwait">Kuwait</option> -<option value="Kyrgyzstan">Kyrgyzstan</option> -<option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option> -<option value="Latvia">Latvia</option> -<option value="Lebanon">Lebanon</option> -<option value="Lesotho">Lesotho</option> -<option value="Liberia">Liberia</option> -<option value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</option> -<option value="Liechtenstein">Liechtenstein</option> -<option value="Lithuania">Lithuania</option> -<option value="Luxembourg">Luxembourg</option> -<option value="Macao">Macao</option> -<option value="Macedonia, The Former Yugoslav Republic Of">Macedonia, The Former Yugoslav Republic Of</option> -<option value="Madagascar">Madagascar</option> -<option value="Malawi">Malawi</option> -<option value="Malaysia">Malaysia</option> -<option value="Maldives">Maldives</option> -<option value="Mali">Mali</option> -<option value="Malta">Malta</option> -<option value="Marshall Islands">Marshall Islands</option> -<option value="Martinique">Martinique</option> -<option value="Mauritania">Mauritania</option> -<option value="Mauritius">Mauritius</option> -<option value="Mayotte">Mayotte</option> -<option value="Mexico">Mexico</option> -<option value="Micronesia, Federated States of">Micronesia, Federated States of</option> -<option value="Moldova, Republic of">Moldova, Republic of</option> -<option value="Monaco">Monaco</option> -<option value="Mongolia">Mongolia</option> -<option value="Montenegro">Montenegro</option> -<option value="Montserrat">Montserrat</option> -<option value="Morocco">Morocco</option> -<option value="Mozambique">Mozambique</option> -<option value="Myanmar">Myanmar</option> -<option value="Namibia">Namibia</option> -<option value="Nauru">Nauru</option> -<option value="Nepal">Nepal</option> -<option value="Netherlands">Netherlands</option> -<option value="Netherlands Antilles">Netherlands Antilles</option> -<option value="New Caledonia">New Caledonia</option> -<option selected="selected" value="New Zealand">New Zealand</option> -<option value="Nicaragua">Nicaragua</option> -<option value="Niger">Niger</option> -<option value="Nigeria">Nigeria</option> -<option value="Niue">Niue</option> -<option value="Norfolk Island">Norfolk Island</option> -<option value="Northern Mariana Islands">Northern Mariana Islands</option> -<option value="Norway">Norway</option> -<option value="Oman">Oman</option> -<option value="Pakistan">Pakistan</option> -<option value="Palau">Palau</option> -<option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option> -<option value="Panama">Panama</option> -<option value="Papua New Guinea">Papua New Guinea</option> -<option value="Paraguay">Paraguay</option> -<option value="Peru">Peru</option> -<option value="Philippines">Philippines</option> -<option value="Pitcairn">Pitcairn</option> -<option value="Poland">Poland</option> -<option value="Portugal">Portugal</option> -<option value="Puerto Rico">Puerto Rico</option> -<option value="Qatar">Qatar</option> -<option value="Reunion">Reunion</option> -<option value="Romania">Romania</option> -<option value="Russian Federation">Russian Federation</option> -<option value="Rwanda">Rwanda</option> -<option value="Saint Barthelemy">Saint Barthelemy</option> -<option value="Saint Helena">Saint Helena</option> -<option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option> -<option value="Saint Lucia">Saint Lucia</option> -<option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option> -<option value="Saint Vincent and the Grenadines">Saint Vincent and the Grenadines</option> -<option value="Samoa">Samoa</option> -<option value="San Marino">San Marino</option> -<option value="Sao Tome and Principe">Sao Tome and Principe</option> -<option value="Saudi Arabia">Saudi Arabia</option> -<option value="Senegal">Senegal</option> -<option value="Serbia">Serbia</option> -<option value="Seychelles">Seychelles</option> -<option value="Sierra Leone">Sierra Leone</option> -<option value="Singapore">Singapore</option> -<option value="Slovakia">Slovakia</option> -<option value="Slovenia">Slovenia</option> -<option value="Solomon Islands">Solomon Islands</option> -<option value="Somalia">Somalia</option> -<option value="South Africa">South Africa</option> -<option value="South Georgia and the South Sandwich Islands">South Georgia and the South Sandwich Islands</option> -<option value="Spain">Spain</option> -<option value="Sri Lanka">Sri Lanka</option> -<option value="Sudan">Sudan</option> -<option value="Suriname">Suriname</option> -<option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option> -<option value="Swaziland">Swaziland</option> -<option value="Sweden">Sweden</option> -<option value="Switzerland">Switzerland</option> -<option value="Syrian Arab Republic">Syrian Arab Republic</option> -<option value="Taiwan, Province of China">Taiwan, Province of China</option> -<option value="Tajikistan">Tajikistan</option> -<option value="Tanzania, United Republic of">Tanzania, United Republic of</option> -<option value="Thailand">Thailand</option> -<option value="Timor-Leste">Timor-Leste</option> -<option value="Togo">Togo</option> -<option value="Tokelau">Tokelau</option> -<option value="Tonga">Tonga</option> -<option value="Trinidad and Tobago">Trinidad and Tobago</option> -<option value="Tunisia">Tunisia</option> -<option value="Turkey">Turkey</option> -<option value="Turkmenistan">Turkmenistan</option> -<option value="Turks and Caicos Islands">Turks and Caicos Islands</option> -<option value="Tuvalu">Tuvalu</option> -<option value="Uganda">Uganda</option> -<option value="Ukraine">Ukraine</option> -<option value="United Arab Emirates">United Arab Emirates</option> -<option value="United Kingdom">United Kingdom</option> -<option value="United States">United States</option> -<option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option> -<option value="Uruguay">Uruguay</option> -<option value="Uzbekistan">Uzbekistan</option> -<option value="Vanuatu">Vanuatu</option> -<option value="Venezuela">Venezuela</option> -<option value="Viet Nam">Viet Nam</option> -<option value="Virgin Islands, British">Virgin Islands, British</option> -<option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option> -<option value="Wallis and Futuna">Wallis and Futuna</option> -<option value="Western Sahara">Western Sahara</option> -<option value="Yemen">Yemen</option> -<option value="Zambia">Zambia</option> -<option value="Zimbabwe">Zimbabwe</option></select> - COUNTRIES - assert_dom_equal(expected_select[0..-2], country_select("post", "origin", ["New Zealand", "Nicaragua"])) - end - - def test_country_select_under_fields_for - @post = Post.new - @post.origin = "Australia" - expected_select = <<-COUNTRIES -<select id="post_origin" name="post[origin]"><option value="Afghanistan">Afghanistan</option> -<option value="Aland Islands">Aland Islands</option> -<option value="Albania">Albania</option> -<option value="Algeria">Algeria</option> -<option value="American Samoa">American Samoa</option> -<option value="Andorra">Andorra</option> -<option value="Angola">Angola</option> -<option value="Anguilla">Anguilla</option> -<option value="Antarctica">Antarctica</option> -<option value="Antigua And Barbuda">Antigua And Barbuda</option> -<option value="Argentina">Argentina</option> -<option value="Armenia">Armenia</option> -<option value="Aruba">Aruba</option> -<option selected="selected" value="Australia">Australia</option> -<option value="Austria">Austria</option> -<option value="Azerbaijan">Azerbaijan</option> -<option value="Bahamas">Bahamas</option> -<option value="Bahrain">Bahrain</option> -<option value="Bangladesh">Bangladesh</option> -<option value="Barbados">Barbados</option> -<option value="Belarus">Belarus</option> -<option value="Belgium">Belgium</option> -<option value="Belize">Belize</option> -<option value="Benin">Benin</option> -<option value="Bermuda">Bermuda</option> -<option value="Bhutan">Bhutan</option> -<option value="Bolivia">Bolivia</option> -<option value="Bosnia and Herzegowina">Bosnia and Herzegowina</option> -<option value="Botswana">Botswana</option> -<option value="Bouvet Island">Bouvet Island</option> -<option value="Brazil">Brazil</option> -<option value="British Indian Ocean Territory">British Indian Ocean Territory</option> -<option value="Brunei Darussalam">Brunei Darussalam</option> -<option value="Bulgaria">Bulgaria</option> -<option value="Burkina Faso">Burkina Faso</option> -<option value="Burundi">Burundi</option> -<option value="Cambodia">Cambodia</option> -<option value="Cameroon">Cameroon</option> -<option value="Canada">Canada</option> -<option value="Cape Verde">Cape Verde</option> -<option value="Cayman Islands">Cayman Islands</option> -<option value="Central African Republic">Central African Republic</option> -<option value="Chad">Chad</option> -<option value="Chile">Chile</option> -<option value="China">China</option> -<option value="Christmas Island">Christmas Island</option> -<option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option> -<option value="Colombia">Colombia</option> -<option value="Comoros">Comoros</option> -<option value="Congo">Congo</option> -<option value="Congo, the Democratic Republic of the">Congo, the Democratic Republic of the</option> -<option value="Cook Islands">Cook Islands</option> -<option value="Costa Rica">Costa Rica</option> -<option value="Cote d'Ivoire">Cote d'Ivoire</option> -<option value="Croatia">Croatia</option> -<option value="Cuba">Cuba</option> -<option value="Cyprus">Cyprus</option> -<option value="Czech Republic">Czech Republic</option> -<option value="Denmark">Denmark</option> -<option value="Djibouti">Djibouti</option> -<option value="Dominica">Dominica</option> -<option value="Dominican Republic">Dominican Republic</option> -<option value="Ecuador">Ecuador</option> -<option value="Egypt">Egypt</option> -<option value="El Salvador">El Salvador</option> -<option value="Equatorial Guinea">Equatorial Guinea</option> -<option value="Eritrea">Eritrea</option> -<option value="Estonia">Estonia</option> -<option value="Ethiopia">Ethiopia</option> -<option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option> -<option value="Faroe Islands">Faroe Islands</option> -<option value="Fiji">Fiji</option> -<option value="Finland">Finland</option> -<option value="France">France</option> -<option value="French Guiana">French Guiana</option> -<option value="French Polynesia">French Polynesia</option> -<option value="French Southern Territories">French Southern Territories</option> -<option value="Gabon">Gabon</option> -<option value="Gambia">Gambia</option> -<option value="Georgia">Georgia</option> -<option value="Germany">Germany</option> -<option value="Ghana">Ghana</option> -<option value="Gibraltar">Gibraltar</option> -<option value="Greece">Greece</option> -<option value="Greenland">Greenland</option> -<option value="Grenada">Grenada</option> -<option value="Guadeloupe">Guadeloupe</option> -<option value="Guam">Guam</option> -<option value="Guatemala">Guatemala</option> -<option value="Guernsey">Guernsey</option> -<option value="Guinea">Guinea</option> -<option value="Guinea-Bissau">Guinea-Bissau</option> -<option value="Guyana">Guyana</option> -<option value="Haiti">Haiti</option> -<option value="Heard and McDonald Islands">Heard and McDonald Islands</option> -<option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option> -<option value="Honduras">Honduras</option> -<option value="Hong Kong">Hong Kong</option> -<option value="Hungary">Hungary</option> -<option value="Iceland">Iceland</option> -<option value="India">India</option> -<option value="Indonesia">Indonesia</option> -<option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option> -<option value="Iraq">Iraq</option> -<option value="Ireland">Ireland</option> -<option value="Isle of Man">Isle of Man</option> -<option value="Israel">Israel</option> -<option value="Italy">Italy</option> -<option value="Jamaica">Jamaica</option> -<option value="Japan">Japan</option> -<option value="Jersey">Jersey</option> -<option value="Jordan">Jordan</option> -<option value="Kazakhstan">Kazakhstan</option> -<option value="Kenya">Kenya</option> -<option value="Kiribati">Kiribati</option> -<option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option> -<option value="Korea, Republic of">Korea, Republic of</option> -<option value="Kuwait">Kuwait</option> -<option value="Kyrgyzstan">Kyrgyzstan</option> -<option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option> -<option value="Latvia">Latvia</option> -<option value="Lebanon">Lebanon</option> -<option value="Lesotho">Lesotho</option> -<option value="Liberia">Liberia</option> -<option value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</option> -<option value="Liechtenstein">Liechtenstein</option> -<option value="Lithuania">Lithuania</option> -<option value="Luxembourg">Luxembourg</option> -<option value="Macao">Macao</option> -<option value="Macedonia, The Former Yugoslav Republic Of">Macedonia, The Former Yugoslav Republic Of</option> -<option value="Madagascar">Madagascar</option> -<option value="Malawi">Malawi</option> -<option value="Malaysia">Malaysia</option> -<option value="Maldives">Maldives</option> -<option value="Mali">Mali</option> -<option value="Malta">Malta</option> -<option value="Marshall Islands">Marshall Islands</option> -<option value="Martinique">Martinique</option> -<option value="Mauritania">Mauritania</option> -<option value="Mauritius">Mauritius</option> -<option value="Mayotte">Mayotte</option> -<option value="Mexico">Mexico</option> -<option value="Micronesia, Federated States of">Micronesia, Federated States of</option> -<option value="Moldova, Republic of">Moldova, Republic of</option> -<option value="Monaco">Monaco</option> -<option value="Mongolia">Mongolia</option> -<option value="Montenegro">Montenegro</option> -<option value="Montserrat">Montserrat</option> -<option value="Morocco">Morocco</option> -<option value="Mozambique">Mozambique</option> -<option value="Myanmar">Myanmar</option> -<option value="Namibia">Namibia</option> -<option value="Nauru">Nauru</option> -<option value="Nepal">Nepal</option> -<option value="Netherlands">Netherlands</option> -<option value="Netherlands Antilles">Netherlands Antilles</option> -<option value="New Caledonia">New Caledonia</option> -<option value="New Zealand">New Zealand</option> -<option value="Nicaragua">Nicaragua</option> -<option value="Niger">Niger</option> -<option value="Nigeria">Nigeria</option> -<option value="Niue">Niue</option> -<option value="Norfolk Island">Norfolk Island</option> -<option value="Northern Mariana Islands">Northern Mariana Islands</option> -<option value="Norway">Norway</option> -<option value="Oman">Oman</option> -<option value="Pakistan">Pakistan</option> -<option value="Palau">Palau</option> -<option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option> -<option value="Panama">Panama</option> -<option value="Papua New Guinea">Papua New Guinea</option> -<option value="Paraguay">Paraguay</option> -<option value="Peru">Peru</option> -<option value="Philippines">Philippines</option> -<option value="Pitcairn">Pitcairn</option> -<option value="Poland">Poland</option> -<option value="Portugal">Portugal</option> -<option value="Puerto Rico">Puerto Rico</option> -<option value="Qatar">Qatar</option> -<option value="Reunion">Reunion</option> -<option value="Romania">Romania</option> -<option value="Russian Federation">Russian Federation</option> -<option value="Rwanda">Rwanda</option> -<option value="Saint Barthelemy">Saint Barthelemy</option> -<option value="Saint Helena">Saint Helena</option> -<option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option> -<option value="Saint Lucia">Saint Lucia</option> -<option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option> -<option value="Saint Vincent and the Grenadines">Saint Vincent and the Grenadines</option> -<option value="Samoa">Samoa</option> -<option value="San Marino">San Marino</option> -<option value="Sao Tome and Principe">Sao Tome and Principe</option> -<option value="Saudi Arabia">Saudi Arabia</option> -<option value="Senegal">Senegal</option> -<option value="Serbia">Serbia</option> -<option value="Seychelles">Seychelles</option> -<option value="Sierra Leone">Sierra Leone</option> -<option value="Singapore">Singapore</option> -<option value="Slovakia">Slovakia</option> -<option value="Slovenia">Slovenia</option> -<option value="Solomon Islands">Solomon Islands</option> -<option value="Somalia">Somalia</option> -<option value="South Africa">South Africa</option> -<option value="South Georgia and the South Sandwich Islands">South Georgia and the South Sandwich Islands</option> -<option value="Spain">Spain</option> -<option value="Sri Lanka">Sri Lanka</option> -<option value="Sudan">Sudan</option> -<option value="Suriname">Suriname</option> -<option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option> -<option value="Swaziland">Swaziland</option> -<option value="Sweden">Sweden</option> -<option value="Switzerland">Switzerland</option> -<option value="Syrian Arab Republic">Syrian Arab Republic</option> -<option value="Taiwan, Province of China">Taiwan, Province of China</option> -<option value="Tajikistan">Tajikistan</option> -<option value="Tanzania, United Republic of">Tanzania, United Republic of</option> -<option value="Thailand">Thailand</option> -<option value="Timor-Leste">Timor-Leste</option> -<option value="Togo">Togo</option> -<option value="Tokelau">Tokelau</option> -<option value="Tonga">Tonga</option> -<option value="Trinidad and Tobago">Trinidad and Tobago</option> -<option value="Tunisia">Tunisia</option> -<option value="Turkey">Turkey</option> -<option value="Turkmenistan">Turkmenistan</option> -<option value="Turks and Caicos Islands">Turks and Caicos Islands</option> -<option value="Tuvalu">Tuvalu</option> -<option value="Uganda">Uganda</option> -<option value="Ukraine">Ukraine</option> -<option value="United Arab Emirates">United Arab Emirates</option> -<option value="United Kingdom">United Kingdom</option> -<option value="United States">United States</option> -<option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option> -<option value="Uruguay">Uruguay</option> -<option value="Uzbekistan">Uzbekistan</option> -<option value="Vanuatu">Vanuatu</option> -<option value="Venezuela">Venezuela</option> -<option value="Viet Nam">Viet Nam</option> -<option value="Virgin Islands, British">Virgin Islands, British</option> -<option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option> -<option value="Wallis and Futuna">Wallis and Futuna</option> -<option value="Western Sahara">Western Sahara</option> -<option value="Yemen">Yemen</option> -<option value="Zambia">Zambia</option> -<option value="Zimbabwe">Zimbabwe</option></select> - COUNTRIES - - fields_for :post, @post do |f| - concat f.country_select("origin") - end - - assert_dom_equal(expected_select[0..-2], output_buffer) - end - - def test_country_select_under_fields_for_with_index - @post = Post.new - @post.origin = "United States" - expected_select = <<-COUNTRIES -<select id="post_325_origin" name="post[325][origin]"><option value="Afghanistan">Afghanistan</option> -<option value="Aland Islands">Aland Islands</option> -<option value="Albania">Albania</option> -<option value="Algeria">Algeria</option> -<option value="American Samoa">American Samoa</option> -<option value="Andorra">Andorra</option> -<option value="Angola">Angola</option> -<option value="Anguilla">Anguilla</option> -<option value="Antarctica">Antarctica</option> -<option value="Antigua And Barbuda">Antigua And Barbuda</option> -<option value="Argentina">Argentina</option> -<option value="Armenia">Armenia</option> -<option value="Aruba">Aruba</option> -<option value="Australia">Australia</option> -<option value="Austria">Austria</option> -<option value="Azerbaijan">Azerbaijan</option> -<option value="Bahamas">Bahamas</option> -<option value="Bahrain">Bahrain</option> -<option value="Bangladesh">Bangladesh</option> -<option value="Barbados">Barbados</option> -<option value="Belarus">Belarus</option> -<option value="Belgium">Belgium</option> -<option value="Belize">Belize</option> -<option value="Benin">Benin</option> -<option value="Bermuda">Bermuda</option> -<option value="Bhutan">Bhutan</option> -<option value="Bolivia">Bolivia</option> -<option value="Bosnia and Herzegowina">Bosnia and Herzegowina</option> -<option value="Botswana">Botswana</option> -<option value="Bouvet Island">Bouvet Island</option> -<option value="Brazil">Brazil</option> -<option value="British Indian Ocean Territory">British Indian Ocean Territory</option> -<option value="Brunei Darussalam">Brunei Darussalam</option> -<option value="Bulgaria">Bulgaria</option> -<option value="Burkina Faso">Burkina Faso</option> -<option value="Burundi">Burundi</option> -<option value="Cambodia">Cambodia</option> -<option value="Cameroon">Cameroon</option> -<option value="Canada">Canada</option> -<option value="Cape Verde">Cape Verde</option> -<option value="Cayman Islands">Cayman Islands</option> -<option value="Central African Republic">Central African Republic</option> -<option value="Chad">Chad</option> -<option value="Chile">Chile</option> -<option value="China">China</option> -<option value="Christmas Island">Christmas Island</option> -<option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option> -<option value="Colombia">Colombia</option> -<option value="Comoros">Comoros</option> -<option value="Congo">Congo</option> -<option value="Congo, the Democratic Republic of the">Congo, the Democratic Republic of the</option> -<option value="Cook Islands">Cook Islands</option> -<option value="Costa Rica">Costa Rica</option> -<option value="Cote d'Ivoire">Cote d'Ivoire</option> -<option value="Croatia">Croatia</option> -<option value="Cuba">Cuba</option> -<option value="Cyprus">Cyprus</option> -<option value="Czech Republic">Czech Republic</option> -<option value="Denmark">Denmark</option> -<option value="Djibouti">Djibouti</option> -<option value="Dominica">Dominica</option> -<option value="Dominican Republic">Dominican Republic</option> -<option value="Ecuador">Ecuador</option> -<option value="Egypt">Egypt</option> -<option value="El Salvador">El Salvador</option> -<option value="Equatorial Guinea">Equatorial Guinea</option> -<option value="Eritrea">Eritrea</option> -<option value="Estonia">Estonia</option> -<option value="Ethiopia">Ethiopia</option> -<option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option> -<option value="Faroe Islands">Faroe Islands</option> -<option value="Fiji">Fiji</option> -<option value="Finland">Finland</option> -<option value="France">France</option> -<option value="French Guiana">French Guiana</option> -<option value="French Polynesia">French Polynesia</option> -<option value="French Southern Territories">French Southern Territories</option> -<option value="Gabon">Gabon</option> -<option value="Gambia">Gambia</option> -<option value="Georgia">Georgia</option> -<option value="Germany">Germany</option> -<option value="Ghana">Ghana</option> -<option value="Gibraltar">Gibraltar</option> -<option value="Greece">Greece</option> -<option value="Greenland">Greenland</option> -<option value="Grenada">Grenada</option> -<option value="Guadeloupe">Guadeloupe</option> -<option value="Guam">Guam</option> -<option value="Guatemala">Guatemala</option> -<option value="Guernsey">Guernsey</option> -<option value="Guinea">Guinea</option> -<option value="Guinea-Bissau">Guinea-Bissau</option> -<option value="Guyana">Guyana</option> -<option value="Haiti">Haiti</option> -<option value="Heard and McDonald Islands">Heard and McDonald Islands</option> -<option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option> -<option value="Honduras">Honduras</option> -<option value="Hong Kong">Hong Kong</option> -<option value="Hungary">Hungary</option> -<option value="Iceland">Iceland</option> -<option value="India">India</option> -<option value="Indonesia">Indonesia</option> -<option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option> -<option value="Iraq">Iraq</option> -<option value="Ireland">Ireland</option> -<option value="Isle of Man">Isle of Man</option> -<option value="Israel">Israel</option> -<option value="Italy">Italy</option> -<option value="Jamaica">Jamaica</option> -<option value="Japan">Japan</option> -<option value="Jersey">Jersey</option> -<option value="Jordan">Jordan</option> -<option value="Kazakhstan">Kazakhstan</option> -<option value="Kenya">Kenya</option> -<option value="Kiribati">Kiribati</option> -<option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option> -<option value="Korea, Republic of">Korea, Republic of</option> -<option value="Kuwait">Kuwait</option> -<option value="Kyrgyzstan">Kyrgyzstan</option> -<option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option> -<option value="Latvia">Latvia</option> -<option value="Lebanon">Lebanon</option> -<option value="Lesotho">Lesotho</option> -<option value="Liberia">Liberia</option> -<option value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</option> -<option value="Liechtenstein">Liechtenstein</option> -<option value="Lithuania">Lithuania</option> -<option value="Luxembourg">Luxembourg</option> -<option value="Macao">Macao</option> -<option value="Macedonia, The Former Yugoslav Republic Of">Macedonia, The Former Yugoslav Republic Of</option> -<option value="Madagascar">Madagascar</option> -<option value="Malawi">Malawi</option> -<option value="Malaysia">Malaysia</option> -<option value="Maldives">Maldives</option> -<option value="Mali">Mali</option> -<option value="Malta">Malta</option> -<option value="Marshall Islands">Marshall Islands</option> -<option value="Martinique">Martinique</option> -<option value="Mauritania">Mauritania</option> -<option value="Mauritius">Mauritius</option> -<option value="Mayotte">Mayotte</option> -<option value="Mexico">Mexico</option> -<option value="Micronesia, Federated States of">Micronesia, Federated States of</option> -<option value="Moldova, Republic of">Moldova, Republic of</option> -<option value="Monaco">Monaco</option> -<option value="Mongolia">Mongolia</option> -<option value="Montenegro">Montenegro</option> -<option value="Montserrat">Montserrat</option> -<option value="Morocco">Morocco</option> -<option value="Mozambique">Mozambique</option> -<option value="Myanmar">Myanmar</option> -<option value="Namibia">Namibia</option> -<option value="Nauru">Nauru</option> -<option value="Nepal">Nepal</option> -<option value="Netherlands">Netherlands</option> -<option value="Netherlands Antilles">Netherlands Antilles</option> -<option value="New Caledonia">New Caledonia</option> -<option value="New Zealand">New Zealand</option> -<option value="Nicaragua">Nicaragua</option> -<option value="Niger">Niger</option> -<option value="Nigeria">Nigeria</option> -<option value="Niue">Niue</option> -<option value="Norfolk Island">Norfolk Island</option> -<option value="Northern Mariana Islands">Northern Mariana Islands</option> -<option value="Norway">Norway</option> -<option value="Oman">Oman</option> -<option value="Pakistan">Pakistan</option> -<option value="Palau">Palau</option> -<option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option> -<option value="Panama">Panama</option> -<option value="Papua New Guinea">Papua New Guinea</option> -<option value="Paraguay">Paraguay</option> -<option value="Peru">Peru</option> -<option value="Philippines">Philippines</option> -<option value="Pitcairn">Pitcairn</option> -<option value="Poland">Poland</option> -<option value="Portugal">Portugal</option> -<option value="Puerto Rico">Puerto Rico</option> -<option value="Qatar">Qatar</option> -<option value="Reunion">Reunion</option> -<option value="Romania">Romania</option> -<option value="Russian Federation">Russian Federation</option> -<option value="Rwanda">Rwanda</option> -<option value="Saint Barthelemy">Saint Barthelemy</option> -<option value="Saint Helena">Saint Helena</option> -<option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option> -<option value="Saint Lucia">Saint Lucia</option> -<option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option> -<option value="Saint Vincent and the Grenadines">Saint Vincent and the Grenadines</option> -<option value="Samoa">Samoa</option> -<option value="San Marino">San Marino</option> -<option value="Sao Tome and Principe">Sao Tome and Principe</option> -<option value="Saudi Arabia">Saudi Arabia</option> -<option value="Senegal">Senegal</option> -<option value="Serbia">Serbia</option> -<option value="Seychelles">Seychelles</option> -<option value="Sierra Leone">Sierra Leone</option> -<option value="Singapore">Singapore</option> -<option value="Slovakia">Slovakia</option> -<option value="Slovenia">Slovenia</option> -<option value="Solomon Islands">Solomon Islands</option> -<option value="Somalia">Somalia</option> -<option value="South Africa">South Africa</option> -<option value="South Georgia and the South Sandwich Islands">South Georgia and the South Sandwich Islands</option> -<option value="Spain">Spain</option> -<option value="Sri Lanka">Sri Lanka</option> -<option value="Sudan">Sudan</option> -<option value="Suriname">Suriname</option> -<option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option> -<option value="Swaziland">Swaziland</option> -<option value="Sweden">Sweden</option> -<option value="Switzerland">Switzerland</option> -<option value="Syrian Arab Republic">Syrian Arab Republic</option> -<option value="Taiwan, Province of China">Taiwan, Province of China</option> -<option value="Tajikistan">Tajikistan</option> -<option value="Tanzania, United Republic of">Tanzania, United Republic of</option> -<option value="Thailand">Thailand</option> -<option value="Timor-Leste">Timor-Leste</option> -<option value="Togo">Togo</option> -<option value="Tokelau">Tokelau</option> -<option value="Tonga">Tonga</option> -<option value="Trinidad and Tobago">Trinidad and Tobago</option> -<option value="Tunisia">Tunisia</option> -<option value="Turkey">Turkey</option> -<option value="Turkmenistan">Turkmenistan</option> -<option value="Turks and Caicos Islands">Turks and Caicos Islands</option> -<option value="Tuvalu">Tuvalu</option> -<option value="Uganda">Uganda</option> -<option value="Ukraine">Ukraine</option> -<option value="United Arab Emirates">United Arab Emirates</option> -<option value="United Kingdom">United Kingdom</option> -<option selected="selected" value="United States">United States</option> -<option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option> -<option value="Uruguay">Uruguay</option> -<option value="Uzbekistan">Uzbekistan</option> -<option value="Vanuatu">Vanuatu</option> -<option value="Venezuela">Venezuela</option> -<option value="Viet Nam">Viet Nam</option> -<option value="Virgin Islands, British">Virgin Islands, British</option> -<option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option> -<option value="Wallis and Futuna">Wallis and Futuna</option> -<option value="Western Sahara">Western Sahara</option> -<option value="Yemen">Yemen</option> -<option value="Zambia">Zambia</option> -<option value="Zimbabwe">Zimbabwe</option></select> - COUNTRIES - - fields_for :post, @post, :index => 325 do |f| - concat f.country_select("origin") - end - - assert_dom_equal(expected_select[0..-2], output_buffer) - end - - def test_country_select_under_fields_for_with_auto_index - @post = Post.new - @post.origin = "Iraq" - def @post.to_param; 325; end - - expected_select = <<-COUNTRIES -<select id="post_325_origin" name="post[325][origin]"><option value="Afghanistan">Afghanistan</option> -<option value="Aland Islands">Aland Islands</option> -<option value="Albania">Albania</option> -<option value="Algeria">Algeria</option> -<option value="American Samoa">American Samoa</option> -<option value="Andorra">Andorra</option> -<option value="Angola">Angola</option> -<option value="Anguilla">Anguilla</option> -<option value="Antarctica">Antarctica</option> -<option value="Antigua And Barbuda">Antigua And Barbuda</option> -<option value="Argentina">Argentina</option> -<option value="Armenia">Armenia</option> -<option value="Aruba">Aruba</option> -<option value="Australia">Australia</option> -<option value="Austria">Austria</option> -<option value="Azerbaijan">Azerbaijan</option> -<option value="Bahamas">Bahamas</option> -<option value="Bahrain">Bahrain</option> -<option value="Bangladesh">Bangladesh</option> -<option value="Barbados">Barbados</option> -<option value="Belarus">Belarus</option> -<option value="Belgium">Belgium</option> -<option value="Belize">Belize</option> -<option value="Benin">Benin</option> -<option value="Bermuda">Bermuda</option> -<option value="Bhutan">Bhutan</option> -<option value="Bolivia">Bolivia</option> -<option value="Bosnia and Herzegowina">Bosnia and Herzegowina</option> -<option value="Botswana">Botswana</option> -<option value="Bouvet Island">Bouvet Island</option> -<option value="Brazil">Brazil</option> -<option value="British Indian Ocean Territory">British Indian Ocean Territory</option> -<option value="Brunei Darussalam">Brunei Darussalam</option> -<option value="Bulgaria">Bulgaria</option> -<option value="Burkina Faso">Burkina Faso</option> -<option value="Burundi">Burundi</option> -<option value="Cambodia">Cambodia</option> -<option value="Cameroon">Cameroon</option> -<option value="Canada">Canada</option> -<option value="Cape Verde">Cape Verde</option> -<option value="Cayman Islands">Cayman Islands</option> -<option value="Central African Republic">Central African Republic</option> -<option value="Chad">Chad</option> -<option value="Chile">Chile</option> -<option value="China">China</option> -<option value="Christmas Island">Christmas Island</option> -<option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option> -<option value="Colombia">Colombia</option> -<option value="Comoros">Comoros</option> -<option value="Congo">Congo</option> -<option value="Congo, the Democratic Republic of the">Congo, the Democratic Republic of the</option> -<option value="Cook Islands">Cook Islands</option> -<option value="Costa Rica">Costa Rica</option> -<option value="Cote d'Ivoire">Cote d'Ivoire</option> -<option value="Croatia">Croatia</option> -<option value="Cuba">Cuba</option> -<option value="Cyprus">Cyprus</option> -<option value="Czech Republic">Czech Republic</option> -<option value="Denmark">Denmark</option> -<option value="Djibouti">Djibouti</option> -<option value="Dominica">Dominica</option> -<option value="Dominican Republic">Dominican Republic</option> -<option value="Ecuador">Ecuador</option> -<option value="Egypt">Egypt</option> -<option value="El Salvador">El Salvador</option> -<option value="Equatorial Guinea">Equatorial Guinea</option> -<option value="Eritrea">Eritrea</option> -<option value="Estonia">Estonia</option> -<option value="Ethiopia">Ethiopia</option> -<option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option> -<option value="Faroe Islands">Faroe Islands</option> -<option value="Fiji">Fiji</option> -<option value="Finland">Finland</option> -<option value="France">France</option> -<option value="French Guiana">French Guiana</option> -<option value="French Polynesia">French Polynesia</option> -<option value="French Southern Territories">French Southern Territories</option> -<option value="Gabon">Gabon</option> -<option value="Gambia">Gambia</option> -<option value="Georgia">Georgia</option> -<option value="Germany">Germany</option> -<option value="Ghana">Ghana</option> -<option value="Gibraltar">Gibraltar</option> -<option value="Greece">Greece</option> -<option value="Greenland">Greenland</option> -<option value="Grenada">Grenada</option> -<option value="Guadeloupe">Guadeloupe</option> -<option value="Guam">Guam</option> -<option value="Guatemala">Guatemala</option> -<option value="Guernsey">Guernsey</option> -<option value="Guinea">Guinea</option> -<option value="Guinea-Bissau">Guinea-Bissau</option> -<option value="Guyana">Guyana</option> -<option value="Haiti">Haiti</option> -<option value="Heard and McDonald Islands">Heard and McDonald Islands</option> -<option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option> -<option value="Honduras">Honduras</option> -<option value="Hong Kong">Hong Kong</option> -<option value="Hungary">Hungary</option> -<option value="Iceland">Iceland</option> -<option value="India">India</option> -<option value="Indonesia">Indonesia</option> -<option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option> -<option selected="selected" value="Iraq">Iraq</option> -<option value="Ireland">Ireland</option> -<option value="Isle of Man">Isle of Man</option> -<option value="Israel">Israel</option> -<option value="Italy">Italy</option> -<option value="Jamaica">Jamaica</option> -<option value="Japan">Japan</option> -<option value="Jersey">Jersey</option> -<option value="Jordan">Jordan</option> -<option value="Kazakhstan">Kazakhstan</option> -<option value="Kenya">Kenya</option> -<option value="Kiribati">Kiribati</option> -<option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option> -<option value="Korea, Republic of">Korea, Republic of</option> -<option value="Kuwait">Kuwait</option> -<option value="Kyrgyzstan">Kyrgyzstan</option> -<option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option> -<option value="Latvia">Latvia</option> -<option value="Lebanon">Lebanon</option> -<option value="Lesotho">Lesotho</option> -<option value="Liberia">Liberia</option> -<option value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</option> -<option value="Liechtenstein">Liechtenstein</option> -<option value="Lithuania">Lithuania</option> -<option value="Luxembourg">Luxembourg</option> -<option value="Macao">Macao</option> -<option value="Macedonia, The Former Yugoslav Republic Of">Macedonia, The Former Yugoslav Republic Of</option> -<option value="Madagascar">Madagascar</option> -<option value="Malawi">Malawi</option> -<option value="Malaysia">Malaysia</option> -<option value="Maldives">Maldives</option> -<option value="Mali">Mali</option> -<option value="Malta">Malta</option> -<option value="Marshall Islands">Marshall Islands</option> -<option value="Martinique">Martinique</option> -<option value="Mauritania">Mauritania</option> -<option value="Mauritius">Mauritius</option> -<option value="Mayotte">Mayotte</option> -<option value="Mexico">Mexico</option> -<option value="Micronesia, Federated States of">Micronesia, Federated States of</option> -<option value="Moldova, Republic of">Moldova, Republic of</option> -<option value="Monaco">Monaco</option> -<option value="Mongolia">Mongolia</option> -<option value="Montenegro">Montenegro</option> -<option value="Montserrat">Montserrat</option> -<option value="Morocco">Morocco</option> -<option value="Mozambique">Mozambique</option> -<option value="Myanmar">Myanmar</option> -<option value="Namibia">Namibia</option> -<option value="Nauru">Nauru</option> -<option value="Nepal">Nepal</option> -<option value="Netherlands">Netherlands</option> -<option value="Netherlands Antilles">Netherlands Antilles</option> -<option value="New Caledonia">New Caledonia</option> -<option value="New Zealand">New Zealand</option> -<option value="Nicaragua">Nicaragua</option> -<option value="Niger">Niger</option> -<option value="Nigeria">Nigeria</option> -<option value="Niue">Niue</option> -<option value="Norfolk Island">Norfolk Island</option> -<option value="Northern Mariana Islands">Northern Mariana Islands</option> -<option value="Norway">Norway</option> -<option value="Oman">Oman</option> -<option value="Pakistan">Pakistan</option> -<option value="Palau">Palau</option> -<option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option> -<option value="Panama">Panama</option> -<option value="Papua New Guinea">Papua New Guinea</option> -<option value="Paraguay">Paraguay</option> -<option value="Peru">Peru</option> -<option value="Philippines">Philippines</option> -<option value="Pitcairn">Pitcairn</option> -<option value="Poland">Poland</option> -<option value="Portugal">Portugal</option> -<option value="Puerto Rico">Puerto Rico</option> -<option value="Qatar">Qatar</option> -<option value="Reunion">Reunion</option> -<option value="Romania">Romania</option> -<option value="Russian Federation">Russian Federation</option> -<option value="Rwanda">Rwanda</option> -<option value="Saint Barthelemy">Saint Barthelemy</option> -<option value="Saint Helena">Saint Helena</option> -<option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option> -<option value="Saint Lucia">Saint Lucia</option> -<option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option> -<option value="Saint Vincent and the Grenadines">Saint Vincent and the Grenadines</option> -<option value="Samoa">Samoa</option> -<option value="San Marino">San Marino</option> -<option value="Sao Tome and Principe">Sao Tome and Principe</option> -<option value="Saudi Arabia">Saudi Arabia</option> -<option value="Senegal">Senegal</option> -<option value="Serbia">Serbia</option> -<option value="Seychelles">Seychelles</option> -<option value="Sierra Leone">Sierra Leone</option> -<option value="Singapore">Singapore</option> -<option value="Slovakia">Slovakia</option> -<option value="Slovenia">Slovenia</option> -<option value="Solomon Islands">Solomon Islands</option> -<option value="Somalia">Somalia</option> -<option value="South Africa">South Africa</option> -<option value="South Georgia and the South Sandwich Islands">South Georgia and the South Sandwich Islands</option> -<option value="Spain">Spain</option> -<option value="Sri Lanka">Sri Lanka</option> -<option value="Sudan">Sudan</option> -<option value="Suriname">Suriname</option> -<option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option> -<option value="Swaziland">Swaziland</option> -<option value="Sweden">Sweden</option> -<option value="Switzerland">Switzerland</option> -<option value="Syrian Arab Republic">Syrian Arab Republic</option> -<option value="Taiwan, Province of China">Taiwan, Province of China</option> -<option value="Tajikistan">Tajikistan</option> -<option value="Tanzania, United Republic of">Tanzania, United Republic of</option> -<option value="Thailand">Thailand</option> -<option value="Timor-Leste">Timor-Leste</option> -<option value="Togo">Togo</option> -<option value="Tokelau">Tokelau</option> -<option value="Tonga">Tonga</option> -<option value="Trinidad and Tobago">Trinidad and Tobago</option> -<option value="Tunisia">Tunisia</option> -<option value="Turkey">Turkey</option> -<option value="Turkmenistan">Turkmenistan</option> -<option value="Turks and Caicos Islands">Turks and Caicos Islands</option> -<option value="Tuvalu">Tuvalu</option> -<option value="Uganda">Uganda</option> -<option value="Ukraine">Ukraine</option> -<option value="United Arab Emirates">United Arab Emirates</option> -<option value="United Kingdom">United Kingdom</option> -<option value="United States">United States</option> -<option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option> -<option value="Uruguay">Uruguay</option> -<option value="Uzbekistan">Uzbekistan</option> -<option value="Vanuatu">Vanuatu</option> -<option value="Venezuela">Venezuela</option> -<option value="Viet Nam">Viet Nam</option> -<option value="Virgin Islands, British">Virgin Islands, British</option> -<option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option> -<option value="Wallis and Futuna">Wallis and Futuna</option> -<option value="Western Sahara">Western Sahara</option> -<option value="Yemen">Yemen</option> -<option value="Zambia">Zambia</option> -<option value="Zimbabwe">Zimbabwe</option></select> - COUNTRIES - - fields_for "post[]", @post do |f| - concat f.country_select("origin") - end - - assert_dom_equal(expected_select[0..-2], output_buffer) - end - def test_time_zone_select @firm = Firm.new("D") html = time_zone_select( "firm", "time_zone" ) |