1
0
Fork 0
mirror of https://github.com/heartcombo/simple_form.git synced 2022-11-09 12:19:26 -05:00

Fixes test for required label

This commit is contained in:
Rafael Mendonça França 2010-10-28 04:47:36 +08:00 committed by José Valim
parent 1231fb1662
commit 8663fae306
2 changed files with 2 additions and 2 deletions

View file

@ -55,7 +55,7 @@ module SimpleForm
end
def attribute_required?
if options.key?(:required)
if !options[:required].nil?
options[:required]
elsif has_validators?
(attribute_validators + reflection_validators).any? { |v| v.kind == :presence }

View file

@ -386,7 +386,7 @@ class FormBuilderTest < ActionView::TestCase
test 'builder should add a required class to label if the attribute is required' do
with_label_for @validating_user, :name
assert_select 'label.string[for=validating_user_name]', /Name/
assert_select 'label.string.required[for=validating_user_name]', /Name/
end
test 'builder should allow passing options to label tag' do