Make custom error work with full_error component
This commit is contained in:
parent
402623c200
commit
70c334123e
|
@ -40,7 +40,7 @@ module SimpleForm
|
|||
end
|
||||
|
||||
def full_errors_on_attribute
|
||||
object.errors.full_messages_for(attribute_name)
|
||||
has_error_in_options? ? [options[:error]] : object.errors.full_messages_for(attribute_name)
|
||||
end
|
||||
|
||||
def errors_on_association
|
||||
|
|
|
@ -145,4 +145,13 @@ class ErrorTest < ActionView::TestCase
|
|||
|
||||
assert_select 'span.error', "#{error_text}"
|
||||
end
|
||||
|
||||
test 'input with custom error works when using full_error component' do
|
||||
swap_wrapper :default, self.custom_wrapper_with_full_error do
|
||||
error_text = "Super User Name! can't be blank"
|
||||
with_custom_error_for(@user, :name, error: error_text)
|
||||
|
||||
assert_select 'span.error', "#{error_text}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue