aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorVasiliy Ermolovich <younash@gmail.com>2012-05-05 20:34:06 +0300
committerVasiliy Ermolovich <younash@gmail.com>2012-05-05 20:34:06 +0300
commite0aadf12e3e6f3e98609bcc51e2428cf3843cfd3 (patch)
treea57d1813d586e603fc1068d91ab3f86fe4e39f93 /actionpack/test
parentacb39848ae4cfe1d22cd8a83c5db636d80c22b47 (diff)
downloadrails-e0aadf12e3e6f3e98609bcc51e2428cf3843cfd3.tar.gz
rails-e0aadf12e3e6f3e98609bcc51e2428cf3843cfd3.tar.bz2
rails-e0aadf12e3e6f3e98609bcc51e2428cf3843cfd3.zip
check checkboxes with array of strings as :checked option
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/template/form_collections_helper_test.rb9
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