mirror of
https://github.com/heartcombo/simple_form.git
synced 2022-11-09 12:19:26 -05:00
Allow collection input to accept a collection of symbols, closes #33
This commit is contained in:
parent
7626fa42df
commit
cf997937e1
2 changed files with 8 additions and 1 deletions
|
@ -46,7 +46,7 @@ module SimpleForm
|
|||
label, value = :first, :last
|
||||
when Integer
|
||||
label, value = :to_s, :to_i
|
||||
when String, NilClass
|
||||
when String, Symbol, NilClass
|
||||
label, value = :to_s, :to_s
|
||||
end
|
||||
|
||||
|
|
|
@ -327,6 +327,13 @@ class InputTest < ActionView::TestCase
|
|||
assert_select 'label.collection_radio', 'CARLOS'
|
||||
end
|
||||
|
||||
test 'input should allow symbols for collections' do
|
||||
with_input_for @user, :name, :select, :collection => [:jose, :carlos]
|
||||
assert_select 'select.select#user_name'
|
||||
assert_select 'select option[value=jose]', 'jose'
|
||||
assert_select 'select option[value=carlos]', 'carlos'
|
||||
end
|
||||
|
||||
# With no object
|
||||
test 'input should be generated properly when object is not present' do
|
||||
with_input_for :project, :name, :string
|
||||
|
|
Loading…
Reference in a new issue