aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-03-15 20:00:50 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-03-15 20:00:50 -0300
commit2d171bdc89b1a29c098477669e14d92b534baf7e (patch)
tree2e9fd5c1eaaa4ee4f24b79e5bc9e61e5bd198a7c /actionview/test
parente3b12f6cb89ff0c5641e80fa9be904b4ed6fabb6 (diff)
parent106c988c10c29332343d8de5719a8b045d093753 (diff)
downloadrails-2d171bdc89b1a29c098477669e14d92b534baf7e.tar.gz
rails-2d171bdc89b1a29c098477669e14d92b534baf7e.tar.bz2
rails-2d171bdc89b1a29c098477669e14d92b534baf7e.zip
Merge pull request #12662 from nashby/include-hidden-collection
add include_hidden option to collection_check_boxes helper Conflicts: actionview/CHANGELOG.md actionview/test/template/form_collections_helper_test.rb
Diffstat (limited to 'actionview/test')
-rw-r--r--actionview/test/template/form_collections_helper_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/actionview/test/template/form_collections_helper_test.rb b/actionview/test/template/form_collections_helper_test.rb
index 18632465db..73fa3b6b4e 100644
--- a/actionview/test/template/form_collections_helper_test.rb
+++ b/actionview/test/template/form_collections_helper_test.rb
@@ -204,6 +204,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 series 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