Update changelog, cleanup some whitespaces and move tests to form builder test
This commit is contained in:
parent
81e3609c3b
commit
42d16bf483
|
@ -13,6 +13,7 @@
|
|||
* Fix for file attributes automatic detection, to work with virtual attributes
|
||||
* Fix for numeric fields validation options using symbols and procs
|
||||
* Fix password attributes to add size and maxlength options the same way as string (by github.com/fedesoria)
|
||||
* Fix bug with custom form builders and new mappings being added to the superclass builder (by github.com/rdvdijk)
|
||||
|
||||
== 1.3.1
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class BuilderTest < ActionView::TestCase
|
||||
class BuilderTest < ActionView::TestCase
|
||||
def with_custom_form_for(object, *args, &block)
|
||||
with_concat_custom_form_for(object) do |f|
|
||||
assert f.instance_of?(CustomFormBuilder)
|
||||
|
@ -19,7 +19,7 @@ class BuilderTest < ActionView::TestCase
|
|||
f.collection_check_boxes attribute, collection, value_method, text_method, options, html_options
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# COLLECTION RADIO
|
||||
test 'collection radio accepts a collection and generate inputs from value method' do
|
||||
with_collection_radio @user, :active, [true, false], :to_s, :to_s
|
||||
|
@ -291,22 +291,4 @@ class BuilderTest < ActionView::TestCase
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
test 'form with CustomMapTypeFormBuilder should use custom map type builder' do
|
||||
with_concat_custom_mapping_form_for(:user) do |user|
|
||||
assert user.instance_of?(CustomMapTypeFormBuilder)
|
||||
end
|
||||
end
|
||||
|
||||
test 'form with CustomMapTypeFormBuilder should use custom mapping' do
|
||||
with_concat_custom_mapping_form_for(:user) do |user|
|
||||
assert_equal SimpleForm::Inputs::StringInput, user.class.mappings[:custom_type]
|
||||
end
|
||||
end
|
||||
|
||||
test 'form without CustomMapTypeFormBuilder should not use custom mapping' do
|
||||
with_concat_form_for(:user) do |user|
|
||||
assert_equal nil, user.class.mappings[:custom_type]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -626,4 +626,22 @@ class FormBuilderTest < ActionView::TestCase
|
|||
with_custom_form_for @user, :email
|
||||
assert_select 'form input[type=email]#user_email.custom'
|
||||
end
|
||||
|
||||
test 'form with CustomMapTypeFormBuilder should use custom map type builder' do
|
||||
with_concat_custom_mapping_form_for(:user) do |user|
|
||||
assert user.instance_of?(CustomMapTypeFormBuilder)
|
||||
end
|
||||
end
|
||||
|
||||
test 'form with CustomMapTypeFormBuilder should use custom mapping' do
|
||||
with_concat_custom_mapping_form_for(:user) do |user|
|
||||
assert_equal SimpleForm::Inputs::StringInput, user.class.mappings[:custom_type]
|
||||
end
|
||||
end
|
||||
|
||||
test 'form without CustomMapTypeFormBuilder should not use custom mapping' do
|
||||
with_concat_form_for(:user) do |user|
|
||||
assert_nil user.class.mappings[:custom_type]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue