Browse files

Remove the internal usage of deprecated :components

Disable each component individually to make sure applications that use
:input_field will not start getting deprecation warnings due to the internal
usage of :components.
  • Loading branch information...
1 parent 229e3aa commit 510bce911c183932660850ce506c22d6c9491897 @carlosantoniodasilva carlosantoniodasilva committed Sep 16, 2011
Showing with 28 additions and 38 deletions.
  1. +1 −1 lib/simple_form/form_builder.rb
  2. +27 −37 test/form_builder_test.rb
View
2 lib/simple_form/form_builder.rb
@@ -113,7 +113,7 @@ def input(attribute_name, options={}, &block)
#
def input_field(attribute_name, options={})
options[:input_html] = options.except(:as, :collection, :label_method, :value_method)
- options.merge!(:components => [:input], :wrapper => false)
+ options.merge!(:label => false, :hint => false, :error => false, :wrapper => false)
input(attribute_name, options)
end
View
64 test/form_builder_test.rb
@@ -453,60 +453,50 @@ def with_association_for(object, *args)
# ONLY THE INPUT TAG
test "builder input_field should only render the input tag, nothing else" do
- ActiveSupport::Deprecation.silence do
- with_concat_form_for(@user) do |f|
- f.input_field :name
- end
- assert_select 'form > input.required.string'
- assert_no_select 'div.string'
- assert_no_select 'label'
- assert_no_select '.hint'
+ with_concat_form_for(@user) do |f|
+ f.input_field :name
end
+ assert_select 'form > input.required.string'
+ assert_no_select 'div.string'
+ assert_no_select 'label'
+ assert_no_select '.hint'
end
test 'builder input_field should allow overriding default input type' do
- ActiveSupport::Deprecation.silence do
- with_concat_form_for(@user) do |f|
- f.input_field :name, :as => :text
- end
-
- assert_no_select 'input#user_name'
- assert_select 'textarea#user_name.text'
+ with_concat_form_for(@user) do |f|
+ f.input_field :name, :as => :text
end
+
+ assert_no_select 'input#user_name'
+ assert_select 'textarea#user_name.text'
end
test 'builder input_field should allow passing options to input tag' do
- ActiveSupport::Deprecation.silence do
- with_concat_form_for(@user) do |f|
- f.input_field :name, :id => 'name_input', :class => 'name'
- end
-
- assert_select 'input.string.name#name_input'
+ with_concat_form_for(@user) do |f|
+ f.input_field :name, :id => 'name_input', :class => 'name'
end
+
+ assert_select 'input.string.name#name_input'
end
test 'builder input_field should generate an input tag with a clean HTML' do
- ActiveSupport::Deprecation.silence do
- with_concat_form_for(@user) do |f|
- f.input_field :name, :as => :integer, :class => 'name'
- end
-
- assert_no_select 'input.integer[input_html]'
- assert_no_select 'input.integer[as]'
+ with_concat_form_for(@user) do |f|
+ f.input_field :name, :as => :integer, :class => 'name'
end
+
+ assert_no_select 'input.integer[input_html]'
+ assert_no_select 'input.integer[as]'
end
test 'builder collection input_field should generate input tag with a clean HTML' do
- ActiveSupport::Deprecation.silence do
- with_concat_form_for(@user) do |f|
- f.input_field :status, :collection => ['Open', 'Closed'], :class => 'status', :label_method => :to_s, :value_method => :to_s
- end
-
- assert_no_select 'select.status[input_html]'
- assert_no_select 'select.status[collection]'
- assert_no_select 'select.status[label_method]'
- assert_no_select 'select.status[value_method]'
+ with_concat_form_for(@user) do |f|
+ f.input_field :status, :collection => ['Open', 'Closed'], :class => 'status', :label_method => :to_s, :value_method => :to_s
end
+
+ assert_no_select 'select.status[input_html]'
+ assert_no_select 'select.status[collection]'
+ assert_no_select 'select.status[label_method]'
+ assert_no_select 'select.status[value_method]'
end
# WITHOUT OBJECT

0 comments on commit 510bce9

Please sign in to comment.