except :as from label_html options

This commit is contained in:
Vasiliy Ermolovich 2012-02-25 14:47:56 +03:00
parent 208cf2a51a
commit 61b47ed8d0
2 changed files with 7 additions and 1 deletions

View File

@ -303,7 +303,7 @@ module SimpleForm
return super if args.first.is_a?(String) || block_given?
options = args.extract_options!.dup
options[:label_html] = options.except(:label, :required)
options[:label_html] = options.except(:label, :required, :as)
column = find_attribute_column(attribute_name)
input_type = default_input_type(attribute_name, column, options)

View File

@ -13,6 +13,12 @@ class LabelTest < ActionView::TestCase
assert_select 'label.string[for=user_name]', /Name/
end
test 'builder should generate a label for the boolean attrbiute' do
with_label_for @user, :name, :as => :boolean
assert_select 'label.boolean[for=user_name]', /Name/
assert_no_select 'label[as=boolean]'
end
test 'builder should generate a label componet tag with a clean HTML' do
with_label_for @user, :name
assert_no_select 'label.string[label_html]'