From 8663fae306d39f6a16a1dac61514d76b50472ce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Thu, 28 Oct 2010 04:47:36 +0800 Subject: [PATCH] Fixes test for required label --- lib/simple_form/inputs/base.rb | 2 +- test/form_builder_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/simple_form/inputs/base.rb b/lib/simple_form/inputs/base.rb index 2115116a..37cf39c5 100644 --- a/lib/simple_form/inputs/base.rb +++ b/lib/simple_form/inputs/base.rb @@ -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 } diff --git a/test/form_builder_test.rb b/test/form_builder_test.rb index 310a8c4f..fde91e86 100644 --- a/test/form_builder_test.rb +++ b/test/form_builder_test.rb @@ -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