Update changelog, cleanup some whitespaces and move tests to form builder test

This commit is contained in:
Carlos Antonio da Silva 2011-04-05 21:46:36 -03:00
parent 81e3609c3b
commit 42d16bf483
3 changed files with 21 additions and 20 deletions

View File

@ -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

View File

@ -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

View File

@ -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