Permalink
Browse files

Failing test to issue #341

  • Loading branch information...
1 parent 5ea7d40 commit 0c8e7c5d4988f24f0e87affc6275194b1ca8f485 @rafaelfranca rafaelfranca committed Oct 5, 2011
Showing with 10 additions and 0 deletions.
  1. +10 −0 test/action_view_extensions/builder_test.rb
@@ -212,6 +212,16 @@ def with_collection_check_boxes(object, attribute, collection, value_method, tex
assert_no_select 'form input[type=checkbox][value=2][checked=checked]'
end
+ test 'collection check box accepts selected values as :checked option and override the model values' do
+ collection = (1..3).map{|i| [i, "Tag #{i}"] }
+ @user.tag_ids = [2]
+ with_collection_check_boxes @user, :tag_ids, collection, :first, :last, :checked => [1, 3]
+
+ assert_select 'form input[type=checkbox][value=1][checked=checked]'
+ assert_select 'form input[type=checkbox][value=3][checked=checked]'
+ assert_no_select 'form input[type=checkbox][value=2][checked=checked]'
+ end
+
test 'collection check box accepts multiple disabled items' do
collection = (1..3).map{|i| [i, "Tag #{i}"] }
with_collection_check_boxes @user, :tag_ids, collection, :first, :last, :disabled => [1, 3]

0 comments on commit 0c8e7c5

Please sign in to comment.