Add tests to cover multiple attribute for grouped select in associations

Also, updates the CHANGELOG.md.
This commit is contained in:
Felipe Renan 2019-01-17 16:04:38 -02:00
parent aae6f9b6fd
commit 7cbedde3de
3 changed files with 12 additions and 1 deletions

View File

@ -7,6 +7,7 @@
* Allow custom error on forms without model. [@victorperez](https://github.com/victorperez)
* Do not support Ruby < 2.3 anymore. [@gssbzn](https://github.com/gssbzn)
* Add color input type. [@gssbzn](https://github.com/gssbzn)
* Set multiple attribute for grouped selects also. [@ollym](https://github.com/ollym)
### Bug fix
* Improve disabled option to input_field. [@betelgeuse](https://github.com/betelgeuse)

View File

@ -243,4 +243,10 @@ class AssociationTest < ActionView::TestCase
assert_equal({ as: :check_boxes, collection_wrapper_tag: :ul, item_wrapper_tag: :li },
options)
end
test 'builder with group select considers multiple select by default' do
with_association_for @user, :tags, as: :grouped_select, group_method: :group_method
assert_select 'select[multiple="multiple"].grouped_select'
end
end

View File

@ -76,7 +76,11 @@ Friend = Struct.new(:id, :name) do
end
end
class Tag < Company; end
class Tag < Company
def group_method
["category-1"]
end
end
TagGroup = Struct.new(:id, :name, :tags)