diff options
author | José Valim <jose.valim@gmail.com> | 2012-05-05 12:10:13 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2012-05-05 12:10:13 -0700 |
commit | f54a35c4eab3d923f650cdd384b388e1b2a9be11 (patch) | |
tree | 8a56d0f7468ecd6ddfc8baf6d33a23bc67905280 /actionpack/test/template/form_collections_helper_test.rb | |
parent | a9668680fd5eda2797f003a710eaf220768d95da (diff) | |
parent | e0aadf12e3e6f3e98609bcc51e2428cf3843cfd3 (diff) | |
download | rails-f54a35c4eab3d923f650cdd384b388e1b2a9be11.tar.gz rails-f54a35c4eab3d923f650cdd384b388e1b2a9be11.tar.bz2 rails-f54a35c4eab3d923f650cdd384b388e1b2a9be11.zip |
Merge pull request #6176 from nashby/checkboxes
check checkboxes with array of strings as :checked option
Diffstat (limited to 'actionpack/test/template/form_collections_helper_test.rb')
-rw-r--r-- | actionpack/test/template/form_collections_helper_test.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/actionpack/test/template/form_collections_helper_test.rb b/actionpack/test/template/form_collections_helper_test.rb index 4d878635ef..c73e80ed88 100644 --- a/actionpack/test/template/form_collections_helper_test.rb +++ b/actionpack/test/template/form_collections_helper_test.rb @@ -195,6 +195,15 @@ class FormCollectionsHelperTest < ActionView::TestCase assert_no_select 'input[type=checkbox][value=2][checked=checked]' end + test 'collection check boxes accepts selected string values as :checked option' do + collection = (1..3).map{|i| [i, "Category #{i}"] } + with_collection_check_boxes :user, :category_ids, collection, :first, :last, :checked => ['1', '3'] + + assert_select 'input[type=checkbox][value=1][checked=checked]' + assert_select 'input[type=checkbox][value=3][checked=checked]' + assert_no_select 'input[type=checkbox][value=2][checked=checked]' + end + test 'collection check boxes accepts a single checked value' do collection = (1..3).map{|i| [i, "Category #{i}"] } with_collection_check_boxes :user, :category_ids, collection, :first, :last, :checked => 3 |