From 106c988c10c29332343d8de5719a8b045d093753 Mon Sep 17 00:00:00 2001 From: Vasiliy Ermolovich Date: Sun, 27 Oct 2013 18:14:16 +0300 Subject: add include_hidden option to collection_check_boxes helper --- actionview/test/template/form_collections_helper_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'actionview/test/template') diff --git a/actionview/test/template/form_collections_helper_test.rb b/actionview/test/template/form_collections_helper_test.rb index d28e4aeb48..4e9cd74df5 100644 --- a/actionview/test/template/form_collections_helper_test.rb +++ b/actionview/test/template/form_collections_helper_test.rb @@ -186,6 +186,13 @@ class FormCollectionsHelperTest < ActionView::TestCase assert_select "input[type=hidden][name='user[other_category_ids][]'][value=]", :count => 1 end + test 'collection check boxes does not generate a hidden field if include_hidden option is false' do + collection = [Category.new(1, 'Category 1'), Category.new(2, 'Category 2')] + with_collection_check_boxes :user, :category_ids, collection, :id, :name, include_hidden: false + + assert_select "input[type=hidden][name='user[category_ids][]'][value=]", :count => 0 + end + test 'collection check boxes accepts a collection and generate a serie of checkboxes with labels for label method' do collection = [Category.new(1, 'Category 1'), Category.new(2, 'Category 2')] with_collection_check_boxes :user, :category_ids, collection, :id, :name -- cgit v1.2.3